public void ContainsOnly_EmptyTestString_ReturnsTrue() { // Arrange string testValue = string.Empty; string allowedCharacters = string.Empty; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.ContainsOnly(testValue, allowedCharacters); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ContainsOnly_AAAWhenOnlyUppercaseAAllowed_ReturnsTrue() { // Arrange string testValue = "AAA"; string allowedCharacters = "A"; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.ContainsOnly(testValue, allowedCharacters); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ContainsOnly_MultilineWhenAllAlphaSpaceAndPunctuationAllowed_ReturnsTrue() { // Arrange string testValue = "This is a full paragraph that should be valid.\tIt even contains a tab.\r\nNot to mention it's multi-line!"; string allowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz .,!?'-()\t\r\n"; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.ContainsOnly(testValue, allowedCharacters); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void ContainsOnly_AAAWhenAllAlphaAndSpaceAllowed_ReturnsTrue() { // Arrange string testValue = "AAA"; string allowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.ContainsOnly(testValue, allowedCharacters); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void DoesNotContainAnyOf_LowercaseABCWhenLowercaseDEFDisallowed_ReturnsTrue() { // Arrange string testValue = "abc"; string[] disallowedFragments = new string[] { "d", "e", "f" }; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.DoesNotContainAnyOf(testValue, disallowedFragments); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void DoesNotContainAnyOf_ABCWhenLowercaseBCandDEDisallowed_ReturnsFalse() { // Arrange string testValue = "ABC"; string[] disallowedFragments = new string[] { "bc", "de" }; bool actualResult; bool expectedResult = false; // Act actualResult = StringContentValidator.DoesNotContainAnyOf(testValue, disallowedFragments); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void DoesNotContainAnyOf_ABCWhenCDandEFDisallowed_ReturnsTrue() { // Arrange string testValue = "ABC"; string[] disallowedFragments = new string[] { "CD", "EF" }; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.DoesNotContainAnyOf(testValue, disallowedFragments); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void DoesNotContainAnyOf_AAAWhenAandCDisallowed_ReturnsFalse() { // Arrange string testValue = "AAA"; string[] disallowedFragments = new string[] { "A", "C" }; bool actualResult; bool expectedResult = false; // Act actualResult = StringContentValidator.DoesNotContainAnyOf(testValue, disallowedFragments); // Assert Assert.AreEqual(expectedResult, actualResult); }
public void DoesNotContainAnyOf_EmptyTestString_ReturnsTrue() { // Arrange string testValue = string.Empty; string[] disallowedFragments = new string[] { }; bool actualResult; bool expectedResult = true; // Act actualResult = StringContentValidator.DoesNotContainAnyOf(testValue, disallowedFragments); // Assert Assert.AreEqual(expectedResult, actualResult); }