public void IsSatisfiedBy_ThereAreInvalidChars_False() { var target = new DeveloperMustHaveValidUsernameSpecification(); var developer = new Developer() { Username = "******" }; Assert.IsFalse(target.IsSatisfiedBy(developer)); Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _."); developer.Username = "******"; Assert.IsFalse(target.IsSatisfiedBy(developer)); Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _."); developer.Username = "******"; Assert.IsFalse(target.IsSatisfiedBy(developer)); Assert.AreEqual(target.NotSatisfiedReason, "Username must have only valid chars: letters, numbers and _."); }
public void IsSatisfiedBy_ThereAreMoreThan30Chars_False() { var target = new DeveloperMustHaveValidUsernameSpecification(); var developer = new Developer() { Username = "******" }; Assert.IsFalse(target.IsSatisfiedBy(developer)); Assert.AreEqual(target.NotSatisfiedReason, "Username max length is 30 chars."); }
public void IsSatisfiedBy_LessThan1Chars_False() { var target = new DeveloperMustHaveValidUsernameSpecification(); var developer = new Developer() { Username = "" }; Assert.IsFalse(target.IsSatisfiedBy(developer)); Assert.AreEqual(target.NotSatisfiedReason, "Username must have at least 1 char."); }
public void IsSatisfiedBy_Valid_True() { var target = new DeveloperMustHaveValidUsernameSpecification(); var developer = new Developer() { Username = "******" }; Assert.IsTrue(target.IsSatisfiedBy(developer)); developer.Username = "******"; Assert.IsTrue(target.IsSatisfiedBy(developer)); developer.Username = "******"; Assert.IsTrue(target.IsSatisfiedBy(developer)); developer.Username = "******"; Assert.IsTrue(target.IsSatisfiedBy(developer)); developer.Username = "******"; Assert.IsTrue(target.IsSatisfiedBy(developer)); }