From 1d278c928179e14528b5f8af81afd13c4f6e6c62 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 8 Nov 2023 22:29:29 +0000 Subject: [PATCH 1/3] chore: add additional tests for other overloads --- .../FMData.Rest.Tests/Find.SendAsync.Tests.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs b/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs index a1cf575..c67c14e 100644 --- a/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs +++ b/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs @@ -36,6 +36,32 @@ public async Task SendAsync_EmptyFind_ShouldReturnMany() Assert.Equal(2, response.Count()); } + [Fact] + public async Task SendAsync_Using_Var_With_Mappers_ShouldReturnMany() + { + var fdc = FindTestsHelpers.GetMockedFDC(); + Func fMRecordIdMapper = (o, id) => o.FileMakerRecordId = id; + Func fMModIdMapper = (o, id) => o.FileMakerRecordId = id; + + var response = await fdc.SendAsync(new FindRequest { Layout = "layout" }, fMRecordIdMapper, fMModIdMapper); + + Assert.Equal(2, response.Count()); + } + + [Fact] + public async Task SendAsync_Explicit_Type_With_Mappers_ShouldReturnMany() + { + var fdc = FindTestsHelpers.GetMockedFDC(); + Func fMRecordIdMapper = (o, id) => o.FileMakerRecordId = id; + Func fMModIdMapper = (o, id) => o.FileMakerRecordId = id; + + User response; + + response = await fdc.SendAsync(new FindRequest { Layout = "layout" }, fMRecordIdMapper, fMModIdMapper); + + Assert.Equal(2, response.Count()); + } + [Fact] [Obsolete] public async Task SendAsync_FindWithoutQuery_ShouldConvertToGetRange_AndReturnMany() From 2101f5351a526c4012b82d05b264e332f5966978 Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 8 Nov 2023 22:42:14 +0000 Subject: [PATCH 2/3] chore: clean up overload ambiguity, add new method name --- src/FMData.Rest/FileMakerRestClient.cs | 2 +- src/FMData.Xml/FileMakerXmlClient.cs | 2 +- src/FMData/FileMakerApiClientBase.cs | 6 +++--- src/FMData/IFileMakerApiClient.cs | 2 +- tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/FMData.Rest/FileMakerRestClient.cs b/src/FMData.Rest/FileMakerRestClient.cs index 762d03a..dcda793 100644 --- a/src/FMData.Rest/FileMakerRestClient.cs +++ b/src/FMData.Rest/FileMakerRestClient.cs @@ -543,7 +543,7 @@ public override async Task SendAsync(IDeleteRequest req) } /// - public override async Task<(IEnumerable, DataInfoModel)> SendAsync( + public override async Task<(IEnumerable, DataInfoModel)> SendFindRequestAsync( IFindRequest req, Func fmId = null, Func modId = null) diff --git a/src/FMData.Xml/FileMakerXmlClient.cs b/src/FMData.Xml/FileMakerXmlClient.cs index 4713d2a..b0082d0 100644 --- a/src/FMData.Xml/FileMakerXmlClient.cs +++ b/src/FMData.Xml/FileMakerXmlClient.cs @@ -181,7 +181,7 @@ public override async Task SendAsync(IEditRequest req) } /// - public override async Task<(IEnumerable, DataInfoModel)> SendAsync( + public override async Task<(IEnumerable, DataInfoModel)> SendFindRequestAsync( IFindRequest req, Func fmId = null, Func modId = null) diff --git a/src/FMData/FileMakerApiClientBase.cs b/src/FMData/FileMakerApiClientBase.cs index 83e81ef..16e4298 100644 --- a/src/FMData/FileMakerApiClientBase.cs +++ b/src/FMData/FileMakerApiClientBase.cs @@ -652,7 +652,7 @@ public virtual async Task> SendAsync( Func fmId, Func modId) where T : class, new() { - var (data, _) = await SendAsync(req, fmId, modId).ConfigureAwait(false); + var (data, _) = await SendFindRequestAsync(req, fmId, modId).ConfigureAwait(false); return data; } @@ -663,11 +663,11 @@ public virtual async Task> SendAsync( Func fmId = null, Func modId = null) where T : class, new() { - return await SendAsync(req, fmId, modId).ConfigureAwait(false); + return await SendFindRequestAsync(req, fmId, modId).ConfigureAwait(false); } /// - public abstract Task<(IEnumerable, DataInfoModel)> SendAsync( + public abstract Task<(IEnumerable, DataInfoModel)> SendFindRequestAsync( IFindRequest req, Func fmId, Func modId) where TResponse : class, new(); diff --git a/src/FMData/IFileMakerApiClient.cs b/src/FMData/IFileMakerApiClient.cs index 635f1ac..0fb7451 100644 --- a/src/FMData/IFileMakerApiClient.cs +++ b/src/FMData/IFileMakerApiClient.cs @@ -501,7 +501,7 @@ Task> SendAsync( /// An matching the request parameters. /// The data info portion of the response is always returned when correctly parsed. /// This method allows using separate Request and Response generics, which is useful when querying with dynamic input, but static output. - Task<(IEnumerable, DataInfoModel)> SendAsync( + Task<(IEnumerable, DataInfoModel)> SendFindRequestAsync( IFindRequest req, Func fmId, Func modId) where TResponse : class, new(); diff --git a/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs b/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs index c67c14e..88ee831 100644 --- a/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs +++ b/tests/FMData.Rest.Tests/Find.SendAsync.Tests.cs @@ -55,7 +55,7 @@ public async Task SendAsync_Explicit_Type_With_Mappers_ShouldReturnMany() Func fMRecordIdMapper = (o, id) => o.FileMakerRecordId = id; Func fMModIdMapper = (o, id) => o.FileMakerRecordId = id; - User response; + IEnumerable response; response = await fdc.SendAsync(new FindRequest { Layout = "layout" }, fMRecordIdMapper, fMModIdMapper); @@ -334,7 +334,7 @@ public async Task SendAsync_Using_Dictionary_Find_Should_Have_DataInfo() req.AddQuery(toFind, false); // act - var (data, info) = await fdc.SendAsync>(req, null, null); + var (data, info) = await fdc.SendFindRequestAsync>(req, null, null); // assert Assert.NotEmpty(data); @@ -365,7 +365,7 @@ public async Task SendAsync_Using_Dictionary_Find_Should_Have_DataInfo_OverloadO req.AddQuery(toFind, false); // act - var (data, info) = await fdc.SendAsync>(req, IdMap, null); + var (data, info) = await fdc.SendFindRequestAsync>(req, IdMap, null); // assert Assert.NotEmpty(data); @@ -396,7 +396,7 @@ public async Task SendAsync_Using_Dictionary_Find_Should_Have_DataInfo_OverloadT req.AddQuery(toFind, false); // act - var (data, info) = await fdc.SendAsync>(req, null, ModMap); + var (data, info) = await fdc.SendFindRequestAsync>(req, null, ModMap); // assert Assert.NotEmpty(data); @@ -427,7 +427,7 @@ public async Task SendAsync_Using_Dictionary_Find_Should_Have_DataInfo_OverloadT req.AddQuery(toFind, false); // act - var (data, info) = await fdc.SendAsync>(req, IdMap, ModMap); + var (data, info) = await fdc.SendFindRequestAsync>(req, IdMap, ModMap); // assert Assert.NotEmpty(data); From bcb45f9c6d0fc4f316f87b3438cb08b19af2009d Mon Sep 17 00:00:00 2001 From: Nate Bross Date: Wed, 8 Nov 2023 22:44:25 +0000 Subject: [PATCH 3/3] chore: fix [Obsolete] message links --- src/FMData.Rest/FileMakerRestClient.cs | 4 ++-- src/FMData.Xml/FileMakerXmlClient.cs | 4 ++-- src/FMData/FileMakerApiClientBase.cs | 4 ++-- src/FMData/IFileMakerApiClient.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/FMData.Rest/FileMakerRestClient.cs b/src/FMData.Rest/FileMakerRestClient.cs index dcda793..44e945f 100644 --- a/src/FMData.Rest/FileMakerRestClient.cs +++ b/src/FMData.Rest/FileMakerRestClient.cs @@ -269,7 +269,7 @@ public async Task LogoutAsync() #region Special Implementations /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public override async Task> FindAsync( string layout, Dictionary req) @@ -309,7 +309,7 @@ public override async Task> FindAsync( /// /// The find request field/value dictionary to pass into FileMaker server. /// A wrapped in a FindResponse containing both record data and portal data. - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public override async Task>> SendAsync(IFindRequest> req) { if (string.IsNullOrEmpty(req.Layout)) throw new ArgumentException("Layout is required on the request."); diff --git a/src/FMData.Xml/FileMakerXmlClient.cs b/src/FMData.Xml/FileMakerXmlClient.cs index b0082d0..fb124d7 100644 --- a/src/FMData.Xml/FileMakerXmlClient.cs +++ b/src/FMData.Xml/FileMakerXmlClient.cs @@ -100,14 +100,14 @@ public override Task GetByFileMakerIdAsync(string layout, int fileMakerId, /// /// Find a record using a dictionary of input parameters. /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public override Task>> SendAsync(IFindRequest> req) { throw new NotImplementedException(); } /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public override Task> FindAsync( string layout, Dictionary req) diff --git a/src/FMData/FileMakerApiClientBase.cs b/src/FMData/FileMakerApiClientBase.cs index 16e4298..754acbb 100644 --- a/src/FMData/FileMakerApiClientBase.cs +++ b/src/FMData/FileMakerApiClientBase.cs @@ -628,7 +628,7 @@ public Task DeleteAsync( /// /// Send a Find Record request to the FileMaker API. /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public abstract Task>> SendAsync(IFindRequest> req); /// @@ -675,7 +675,7 @@ public virtual async Task> SendAsync( #endregion /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] public abstract Task> FindAsync(string layout, Dictionary req); /// diff --git a/src/FMData/IFileMakerApiClient.cs b/src/FMData/IFileMakerApiClient.cs index 0fb7451..8be30f5 100644 --- a/src/FMData/IFileMakerApiClient.cs +++ b/src/FMData/IFileMakerApiClient.cs @@ -295,7 +295,7 @@ public interface IFileMakerApiClient /// /// /// - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] Task> FindAsync(string layout, Dictionary req); #endregion @@ -444,7 +444,7 @@ Task UpdateContainerAsync( /// Find a record or records matching the request. /// /// Find request. - [Obsolete("Use SendAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/326")] + [Obsolete("Use SendFindRequestAsync() instead. See also: https://github.com/fuzzzerd/fmdata/pull/328")] Task>> SendAsync(IFindRequest> req); ///