public void ShouldReturnFalseWhenComparingNonEmptyTextsWithDifferentValue() { var firstText = NonEmptyText.Create(SampleTextValue).Value; var secondText = NonEmptyText.Create("another").Value; Assert.AreNotEqual(firstText, secondText); }
public void SholdReturnTrueWhenComparingNonEmptyTextsWithSameValue() { var firstText = NonEmptyText.Create(SampleTextValue).Value; var secondText = NonEmptyText.Create(SampleTextValue).Value; Assert.AreEqual(firstText, secondText); }
public void ShouldCreateNonEmptyTextWithNonEmptyValueCorrectly() { const string textValue = SampleTextValue; var textResult = NonEmptyText.Create(textValue); Assert.IsTrue(textResult.IsSuccess); Assert.AreEqual(textValue, textResult.Value); }
public static ValueResult <Student> Create(string name) { var nameResult = NonEmptyText.Create(name); if (nameResult.IsFailure) { return(ValueResult <Student> .Fail(nameResult.Error)); } return(ValueResult <Student> .Ok(new Student(nameResult.Value))); }
public void ShouldReturnResultFailWhenCreatingNonEmptyTextWithWhitespacesOnly() { var textResult = NonEmptyText.Create(" "); Assert.IsTrue(textResult.IsFailure); }
public void ShouldReturnResultFailWhenCreatingNonEmptyTextWithEmptyValue() { var textResult = NonEmptyText.Create(string.Empty); Assert.IsTrue(textResult.IsFailure); }