public void NullStringValue() { // passing null to format should return null TrimSpacesFormatter formatter = new TrimSpacesFormatter(); var formatted = formatter.Format(null); formatted.Should().BeNull(); }
public void EmptyOrWhitespacesValueShouldReturnEmptyString(string inValue) { TrimSpacesFormatter formatter = new TrimSpacesFormatter(); // expecting a string other than null is always returned var formatted = formatter.Format(inValue) as string; formatted.Length.Should().Be(0); }
public void FormatValueNameResolveManagerEntityShouldNotThrowNotImplemented() { TrimSpacesFormatter formatter = new TrimSpacesFormatter(); Action act = () => formatter.Format("something", "somename", null, null); act.ShouldNotThrow <NotImplementedException>(); }
public void FormatValueNameShouldNotThrowNotImplemented() { TrimSpacesFormatter formatter = new TrimSpacesFormatter(); Action act = () => formatter.Format("something", "somename"); act.ShouldNotThrow <NotImplementedException>(); }
public void ValuesToTrim(string inValue) { TrimSpacesFormatter formatter = new TrimSpacesFormatter(); // expecting a string other than null is always returned var formatted = formatter.Format(inValue) as string; // all test cases have atleast one whitespace to trim formatted.Length.Should().BeLessOrEqualTo(inValue.Length - 1); }
public void ValidValuesNothingToTrim(string inValue) { TrimSpacesFormatter formatter = new TrimSpacesFormatter(); // expecting a string other than null is always returned var formatted = formatter.Format(inValue) as string; // expecting same reference as the string shouldn't be modified formatted.Should().BeSameAs(inValue); }
public void TestWithObject() { // the formatter expects the value to be string TrimSpacesFormatter formatter = new TrimSpacesFormatter(); SomeDemoObject obj = new SomeDemoObject() { Integer = 100, String = "Some text", Type = "Demo" }; Action act = () => formatter.Format(obj); act.ShouldThrowExactly <PtvArgumentException>($"Expected value is string! Value {obj.ToString()} of type SomeDemoObject is not valid."); }