Update to latest packages and show examples
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
using AwesomeAssertions;
|
||||
using GerstITS.Examples.Logic.Customers;
|
||||
using GerstITS.Examples.Logic.Customers.Search;
|
||||
using GerstITS.TestFramework;
|
||||
using Xunit;
|
||||
|
||||
namespace GerstITS.Examples.Tests.Customers.Search;
|
||||
|
||||
[TestCategory(TestCategories.Unit)]
|
||||
public sealed class CustomerSearchFilterInitializationRuleTest
|
||||
{
|
||||
#region Tests
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_empty___Defaults_are_applied()
|
||||
{
|
||||
var filter = new CustomerSearchFilter();
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Skip.Should().Be(0);
|
||||
initialized.Take.Should().Be(50);
|
||||
initialized.SortBy.Should().Be(nameof(Customer.LastName));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_the_filter_is_already_configured___Values_are_kept()
|
||||
{
|
||||
var filter = new CustomerSearchFilter
|
||||
{
|
||||
Skip = 10,
|
||||
Take = 5,
|
||||
SortBy = nameof(Customer.EMail)
|
||||
};
|
||||
|
||||
var initialized = new CustomerSearchFilterInitializationRule().Initialize(filter);
|
||||
|
||||
initialized.Skip.Should().Be(10);
|
||||
initialized.Take.Should().Be(5);
|
||||
initialized.SortBy.Should().Be(nameof(Customer.EMail));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void If_another_filter_type_is_checked___It_cannot_be_initialized()
|
||||
{
|
||||
new CustomerSearchFilterInitializationRule().CanInitialize<string>().Should().BeFalse();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user