Update to latest packages and show examples

This commit is contained in:
2026-07-05 22:05:53 +02:00
parent 3a36978997
commit c7ddc282ed
52 changed files with 2156 additions and 21 deletions
@@ -0,0 +1,67 @@
using AwesomeAssertions;
using GerstITS.Examples.Logic.Customers;
using GerstITS.Examples.Logic.Customers.Validation;
using GerstITS.TestFramework;
using Xunit;
namespace GerstITS.Examples.Tests.Customers.Validation;
[TestCategory(TestCategories.Unit)]
public sealed class CustomerValidationRuleTest
{
#region Tests
[Fact]
public void If_a_customer_is_complete___It_is_valid()
{
var customer = CreateCustomer();
var result = new CustomerValidationRule().Validate((object)customer);
result.IsValid.Should().BeTrue();
}
[Fact]
public void If_the_first_name_is_missing___It_is_invalid()
{
var customer = CreateCustomer();
customer.FirstName = string.Empty;
var result = new CustomerValidationRule().Validate((object)customer);
result.IsValid.Should().BeFalse();
}
[Fact]
public void If_the_email_has_no_valid_format___It_is_invalid()
{
var customer = CreateCustomer();
customer.EMail = "not-an-email";
var result = new CustomerValidationRule().Validate((object)customer);
result.IsValid.Should().BeFalse();
}
[Fact]
public void If_a_customer_type_is_checked___It_can_be_validated()
{
new CustomerValidationRule().CanValidate(typeof(Customer)).Should().BeTrue();
}
#endregion
#region Methods
private static Customer CreateCustomer()
{
return new Customer
{
FirstName = "Erika",
LastName = "Mustermann",
EMail = "erika.mustermann@example.com"
};
}
#endregion
}