public void Should_Be_Invalid_Values_For_Prime_String() { // Arr var primeString = new Domain.Models.PrimeString("", ""); // Act var result = primeString.ArePrimes(); // Ass primeString.Valid.Should().BeFalse(); result.Should().BeFalse(); }
public void Should_Be_Not_Primes_Strings(string firstString, string secondString) { // Arr var primeString = new Domain.Models.PrimeString(firstString, secondString); // Act var result = primeString.ArePrimes(); // Ass primeString.Notifications.Count.Should().Be(0); primeString.Valid.Should().BeTrue(); result.Should().BeFalse(); }
public void Should_Be_Invalid_Values_For_Prime_String_With_One_Notification() { // Arr var primeString = new Domain.Models.PrimeString("test", ""); // Act var result = primeString.ArePrimes(); // Ass primeString.Notifications.Count.Should().Be(1); primeString.Valid.Should().BeFalse(); result.Should().BeFalse(); }
/// <inheritdoc /> public bool CheckArePrimes(string firstString, string secondString) { var primeString = new Domain.Models.PrimeString(firstString, secondString); if (!primeString.Invalid) { return(primeString.ArePrimes()); } var errorsBuilder = new StringBuilder(); primeString.Notifications.ToList().ForEach(x => errorsBuilder.AppendLine($"{x.Property} : {x.Message}")); throw new ArgumentException(errorsBuilder.ToString()); }