From 9d61ce3de7deb9b1e572fc2bc437f64c8a08c626 Mon Sep 17 00:00:00 2001 From: Matthias Gernand Date: Sun, 2 Jun 2024 14:01:54 +0200 Subject: [PATCH] Updated packages. (#53) --- ...era.ValueObject.EntityFrameworkCore.csproj | 6 ++-- ...bject.EntityFrameworkCore.UnitTests.csproj | 6 ++-- .../Fluxera.ValueObject.UnitTests.csproj | 1 - .../Model/Address.cs | 6 ---- .../Model/BankAccount.cs | 5 --- .../Model/Confederation.cs | 4 --- .../ConfederationIncorrectImplementation.cs | 4 --- .../Model/Country.cs | 2 -- .../Model/GermanBankAccount.cs | 2 -- .../Model/GuardAgainstExtensions.cs | 32 ------------------- 10 files changed, 6 insertions(+), 62 deletions(-) delete mode 100644 tests/Fluxera.ValueObject.UnitTests/Model/GuardAgainstExtensions.cs diff --git a/src/Fluxera.ValueObject.EntityFrameworkCore/Fluxera.ValueObject.EntityFrameworkCore.csproj b/src/Fluxera.ValueObject.EntityFrameworkCore/Fluxera.ValueObject.EntityFrameworkCore.csproj index a08ad77..34aa8bb 100644 --- a/src/Fluxera.ValueObject.EntityFrameworkCore/Fluxera.ValueObject.EntityFrameworkCore.csproj +++ b/src/Fluxera.ValueObject.EntityFrameworkCore/Fluxera.ValueObject.EntityFrameworkCore.csproj @@ -30,15 +30,15 @@ - + - + - + diff --git a/tests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests.csproj b/tests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests.csproj index 4e60d8d..83ecde4 100644 --- a/tests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests.csproj +++ b/tests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests/Fluxera.ValueObject.EntityFrameworkCore.UnitTests.csproj @@ -23,15 +23,15 @@ - + - + - + diff --git a/tests/Fluxera.ValueObject.UnitTests/Fluxera.ValueObject.UnitTests.csproj b/tests/Fluxera.ValueObject.UnitTests/Fluxera.ValueObject.UnitTests.csproj index 477eb91..648b529 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Fluxera.ValueObject.UnitTests.csproj +++ b/tests/Fluxera.ValueObject.UnitTests/Fluxera.ValueObject.UnitTests.csproj @@ -7,7 +7,6 @@ - diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/Address.cs b/tests/Fluxera.ValueObject.UnitTests/Model/Address.cs index 7a96043..5bc0cd2 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/Address.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/Address.cs @@ -1,7 +1,6 @@ namespace Fluxera.ValueObject.UnitTests.Model { using System; - using Fluxera.Guards; using JetBrains.Annotations; [PublicAPI] @@ -9,11 +8,6 @@ public class Address : ValueObject
, IComparable { public Address(string street, string houseNumber, string postCode, string city) { - Guard.Against.NullOrWhiteSpace(street, nameof(street)); - Guard.Against.NullOrWhiteSpace(houseNumber, nameof(houseNumber)); - Guard.Against.NullOrWhiteSpace(postCode, nameof(postCode)); - Guard.Against.NullOrWhiteSpace(city, nameof(city)); - this.Street = street; this.HouseNumber = houseNumber; this.PostCode = postCode; diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/BankAccount.cs b/tests/Fluxera.ValueObject.UnitTests/Model/BankAccount.cs index 8e18242..c94272b 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/BankAccount.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/BankAccount.cs @@ -1,6 +1,5 @@ namespace Fluxera.ValueObject.UnitTests.Model { - using Guards; using JetBrains.Annotations; [PublicAPI] @@ -8,10 +7,6 @@ public class BankAccount : ValueObject { public BankAccount(string name, string iban, string bic) { - Guard.Against.NullOrWhiteSpace(name, nameof(name)); - Guard.Against.NullOrWhiteSpace(iban, nameof(iban)); - Guard.Against.NullOrWhiteSpace(bic, nameof(bic)); - this.Name = name; this.Iban = iban; this.Bic = bic; diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/Confederation.cs b/tests/Fluxera.ValueObject.UnitTests/Model/Confederation.cs index 7f67c60..1f2b22c 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/Confederation.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/Confederation.cs @@ -1,7 +1,6 @@ namespace Fluxera.ValueObject.UnitTests.Model { using System.Collections.Generic; - using Guards; using JetBrains.Annotations; [PublicAPI] @@ -9,9 +8,6 @@ public class Confederation : ValueObject { public Confederation(string name, IList memberCountries) { - Guard.Against.NullOrWhiteSpace(name, nameof(name)); - Guard.Against.NullOrEmpty(memberCountries, nameof(memberCountries)); - this.Name = name; this.MemberCountries = memberCountries.AsValueList(); } diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/ConfederationIncorrectImplementation.cs b/tests/Fluxera.ValueObject.UnitTests/Model/ConfederationIncorrectImplementation.cs index 798569b..7f9efe8 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/ConfederationIncorrectImplementation.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/ConfederationIncorrectImplementation.cs @@ -1,7 +1,6 @@ namespace Fluxera.ValueObject.UnitTests.Model { using System.Collections.Generic; - using Guards; using JetBrains.Annotations; [PublicAPI] @@ -9,9 +8,6 @@ public class ConfederationIncorrectImplementation : ValueObject { public ConfederationIncorrectImplementation(string name, IList memberCountries) { - Guard.Against.NullOrWhiteSpace(name, nameof(name)); - Guard.Against.NullOrEmpty(memberCountries, nameof(memberCountries)); - this.Name = name; this.MemberCountries = memberCountries; } diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/Country.cs b/tests/Fluxera.ValueObject.UnitTests/Model/Country.cs index 17bd20e..2354f52 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/Country.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/Country.cs @@ -1,6 +1,5 @@ namespace Fluxera.ValueObject.UnitTests.Model { - using Guards; using JetBrains.Annotations; [PublicAPI] @@ -9,7 +8,6 @@ public class Country : ValueObject public Country(string twoLetterCode) { this.TwoLetterCode = twoLetterCode; - Guard.Against.InvalidLength(twoLetterCode, nameof(twoLetterCode), 2); } public string TwoLetterCode { get; } diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/GermanBankAccount.cs b/tests/Fluxera.ValueObject.UnitTests/Model/GermanBankAccount.cs index 329545a..939f448 100644 --- a/tests/Fluxera.ValueObject.UnitTests/Model/GermanBankAccount.cs +++ b/tests/Fluxera.ValueObject.UnitTests/Model/GermanBankAccount.cs @@ -1,6 +1,5 @@ namespace Fluxera.ValueObject.UnitTests.Model { - using Guards; using JetBrains.Annotations; [PublicAPI] @@ -10,7 +9,6 @@ public class GermanBankAccount : BankAccount public GermanBankAccount(string name, string iban, string bic) : base(name, iban, bic) { - Guard.Against.NonGermanIban(iban, nameof(iban)); } } } diff --git a/tests/Fluxera.ValueObject.UnitTests/Model/GuardAgainstExtensions.cs b/tests/Fluxera.ValueObject.UnitTests/Model/GuardAgainstExtensions.cs deleted file mode 100644 index 4bcda1f..0000000 --- a/tests/Fluxera.ValueObject.UnitTests/Model/GuardAgainstExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Fluxera.ValueObject.UnitTests.Model -{ - using Guards; - using JetBrains.Annotations; - using static Guards.ExceptionHelpers; - - [PublicAPI] - public static class GuardAgainstExtensions - { - public static string NonGermanIban(this IGuard guard, string input, [InvokerParameterName] string parameterName) - { - Guard.Against.NullOrWhiteSpace(input, nameof(input)); - - if(!input.StartsWith("DE")) - { - throw CreateArgumentException(parameterName, "Value cannot be a non-german IBAN."); - } - - return input; - } - - public static string InvalidLength(this IGuard guard, string input, [InvokerParameterName] string parameterName, int allowedLength) - { - if(input.Length != allowedLength) - { - throw CreateArgumentException(parameterName, $"Value cannot be other than {allowedLength} characters in length."); - } - - return input; - } - } -}