-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Since users' countries are displayed instead of application countries it is possible to have users in a non-filtered result being counted towards a country that when filtered they don't show up for, this is resolved by OR with the user's country when filtering + Added facet count test + Updated NuGet packages + Fixed NetFramework target for running isolated mode in Azure Functions Special thanks to @marcelgruber Co-authored-by: Ivan Lieckens <[email protected]>
- Loading branch information
1 parent
15d7dbf
commit 8032c43
Showing
11 changed files
with
87 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
tests/Mvp.Selections.Api.Tests/Services/UserServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using AutoFixture.Xunit2; | ||
using FluentAssertions; | ||
using Mvp.Selections.Api.Cache; | ||
using Mvp.Selections.Api.Model; | ||
using Mvp.Selections.Api.Model.Request; | ||
using Mvp.Selections.Api.Services; | ||
using Mvp.Selections.Api.Services.Interfaces; | ||
using Mvp.Selections.Domain; | ||
using Mvp.Selections.Tests.Utilities; | ||
using NSubstitute; | ||
using Xunit; | ||
|
||
namespace Mvp.Selections.Api.Tests.Services | ||
{ | ||
public class UserServiceTests | ||
{ | ||
[Theory] | ||
[AutoNSubstituteData] | ||
public async Task SearchMvpProfileAsync_FacetCountValidation([Frozen] ICacheManager cache, UserService sut, MvpProfile mvp1, MvpProfile mvp2, MvpProfile mvp3, Country country1, Country country2, MvpType type1) | ||
{ | ||
// Arrange | ||
mvp1.Country = country1; | ||
mvp1.Titles.Clear(); | ||
mvp1.Titles.Add(new Title(Guid.NewGuid()) | ||
{ | ||
MvpType = type1, | ||
Application = new Application(Guid.NewGuid()) | ||
{ Selection = new Selection(Guid.NewGuid()) { Year = 1800 } } | ||
}); | ||
|
||
mvp2.Country = country1; | ||
mvp2.Titles.Clear(); | ||
mvp2.Titles.Add(new Title(Guid.NewGuid()) | ||
{ | ||
MvpType = type1, | ||
Application = new Application(Guid.NewGuid()) | ||
{ Selection = new Selection(Guid.NewGuid()) { Year = 1801 } } | ||
}); | ||
|
||
mvp3.Country = country2; | ||
mvp3.Titles.Clear(); | ||
mvp3.Titles.Add(new Title(Guid.NewGuid()) | ||
{ | ||
MvpType = type1, | ||
Application = new Application(Guid.NewGuid()) | ||
{ Selection = new Selection(Guid.NewGuid()) { Year = 1803 } } | ||
}); | ||
|
||
cache.TryGet(Arg.Any<string>(), out Arg.Any<List<MvpProfile>?>()).Returns(x => | ||
{ | ||
x[1] = new List<MvpProfile> { mvp1, mvp2, mvp3 }; | ||
return true; | ||
}); | ||
|
||
// Act | ||
SearchOperationResult<MvpProfile> result = await sut.SearchMvpProfileAsync(); | ||
|
||
// Assert | ||
result.Result.TotalResults.Should().Be(3); | ||
result.Result.Facets.Single(f => f.Identifier == IMvpProfileService.CountryFacetIdentifier).Options.Should().HaveCount(2); | ||
result.Result.Facets.Single(f => f.Identifier == IMvpProfileService.TypeFacetIdentifier).Options.Should().HaveCount(1); | ||
result.Result.Facets.Single(f => f.Identifier == IMvpProfileService.YearFacetIdentifier).Options.Should().HaveCount(3); | ||
} | ||
} | ||
} |