public void Validate_TrueWhenAllDataIsValid() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "appurl", EmailAddress = "*****@*****.**", FirstName = "first", LastName = "last", AccountId = "accountid" }; Assert.IsTrue(detail.Validate()); Assert.IsFalse(detail.Errors.Any()); }
public void Validate_FalseWhenEmailAddressIsInvalid() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "appurl", EmailAddress = "email", FirstName = "first", LastName = "last", AccountId = "accountid" }; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("EmailAddress", detail.Errors.ElementAt(0).PropertyName); }
public void Validate_FalseWhenLastNameIsMissing() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "appurl", EmailAddress = "*****@*****.**", FirstName = "first", LastName = "", AccountId = "accountid" }; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("LastName", detail.Errors.ElementAt(0).PropertyName); detail.LastName = null; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("LastName", detail.Errors.ElementAt(0).PropertyName); }
public void Validate_FalseWhenApplicationUrlIsMissing() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "", EmailAddress = "*****@*****.**", FirstName = "first", LastName = "last", AccountId = "accountid" }; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("ApplicationUrl", detail.Errors.ElementAt(0).PropertyName); detail.ApplicationUrl = null; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("ApplicationUrl", detail.Errors.ElementAt(0).PropertyName); }
public void Validate_FalseWhenEmailAddressIsInvalid() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "appurl", EmailAddress = "email", FirstName = "first", LastName = "last", AccountId = "accountid" }; Assert.IsFalse(detail.Validate()); Assert.AreEqual(1, detail.Errors.Count()); Assert.AreEqual("EmailAddress", detail.Errors.ElementAt(0).PropertyName); }
public void Validate_TrueWhenAllDataIsValid() { var detail = new CreateApplicationDetail { ApplicationName = "appname", ApplicationUrl = "appurl", EmailAddress = "*****@*****.**", FirstName = "first", LastName = "last", AccountId = "accountid" }; Assert.IsTrue(detail.Validate()); Assert.IsFalse(detail.Errors.Any()); }