Update examples
This commit is contained in:
+48
-2
@@ -12,19 +12,37 @@ public sealed class CustomerSearchFilterInitializationRuleTest
|
||||
#region Tests
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_empty___Defaults_are_applied()
|
||||
public void If_the_filter_is_empty___The_skip_default_is_applied()
|
||||
{
|
||||
var filter = new CustomerSearchFilter();
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Skip.Should().Be(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_empty___The_take_default_is_applied()
|
||||
{
|
||||
var filter = new CustomerSearchFilter();
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Take.Should().Be(50);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_empty___The_sort_by_default_is_applied()
|
||||
{
|
||||
var filter = new CustomerSearchFilter();
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.SortBy.Should().Be(nameof(Customer.LastName));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_already_configured___Values_are_kept()
|
||||
public void If_the_filter_is_already_configured___The_skip_is_kept()
|
||||
{
|
||||
var filter = new CustomerSearchFilter
|
||||
{
|
||||
@@ -36,7 +54,35 @@ public sealed class CustomerSearchFilterInitializationRuleTest
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Skip.Should().Be(10);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_already_configured___The_take_is_kept()
|
||||
{
|
||||
var filter = new CustomerSearchFilter
|
||||
{
|
||||
Skip = 10,
|
||||
Take = 5,
|
||||
SortBy = nameof(Customer.EMail)
|
||||
};
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Take.Should().Be(5);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_already_configured___The_sort_by_is_kept()
|
||||
{
|
||||
var filter = new CustomerSearchFilter
|
||||
{
|
||||
Skip = 10,
|
||||
Take = 5,
|
||||
SortBy = nameof(Customer.EMail)
|
||||
};
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.SortBy.Should().Be(nameof(Customer.EMail));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GerstITS.TestFramework" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="AwesomeAssertions" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.v3" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -46,11 +46,10 @@ public sealed class SortingProviderTest
|
||||
|
||||
private static IEnumerable<Customer> CreateCustomers()
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
return [
|
||||
new Customer { FirstName = "Anna", LastName = "Albrecht" },
|
||||
new Customer { FirstName = "Zoe", LastName = "Zimmermann" }
|
||||
};
|
||||
];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user