public void UniqueConstrainSetsCorrectMessage() { // Arrange var setup = new ValidationSetup <string>(); // Act setup.Unique(new[] { "a" }); // Assert Assert.AreEqual(Strings.NameAlreadyExists, setup.MessageString); }
public void NotEmptySetsCorrectMessage() { // Arrange var setup = new ValidationSetup <string>(); // Act setup.NotEmpty(); // Assert Assert.AreEqual(Strings.ValueMustNotBeEmpty, setup.MessageString); }
public void SelectedNotNullChecksForNull() { // Arrange var setup = new ValidationSetup <object>(); // Act setup.SelectedNotNull(); // Assert Assert.IsTrue(setup.CheckFunc(new object())); Assert.IsFalse(setup.CheckFunc(null)); }
public void NotEmptyChecksForNull() { // Arrange var setup = new ValidationSetup <int?>(); // Act setup.NotEmpty(); // Assert Assert.IsTrue(setup.CheckFunc(1)); Assert.IsFalse(setup.CheckFunc(null)); }
public void UniqueConstrainIsChecked() { // Arrange var setup = new ValidationSetup <string>(); var list = new[] { "test", "abc" }; // Act setup.Unique(list); // Assert Assert.IsTrue(setup.CheckFunc("42")); Assert.IsFalse(setup.CheckFunc("test")); }
public void NotEmptyRespectsWhitespaces() { // Arrange const string emptyString = "\t \r\n"; var whitespaceSetup = new ValidationSetup <string>(); var setup = new ValidationSetup <string>(); // Act whitespaceSetup.NotEmpty(true); setup.NotEmpty(); // Assert Assert.IsTrue(whitespaceSetup.CheckFunc(emptyString)); Assert.IsFalse(setup.CheckFunc(emptyString)); }