public void CustomerDataTest_Success() { UpdateProfileResponse r = new UpdateProfileResponse(); string Country = "US"; string Language = "ro"; string FirstName = "firstName"; string LastName = "lastName"; bool EmailOffers = true; string PrimaryUse = "Item002"; string City = "city"; string Company = "HP Inc"; bool ActiveHealth = true; RESTAPICustomerData requestCustData = new RESTAPICustomerData() { Country = Country, Language = Language, FirstName = FirstName, LastName = LastName, EmailOffers = EmailOffers, PrimaryUse = PrimaryUse, City = City, Company = Company, ActiveHealth = ActiveHealth }; ResponseBase response = new ResponseBase(); Assert.IsTrue(requestCustData.IsValid(response)); Assert.AreEqual(response.ErrorList.Count, 0); }
public void CustomerDataTest_InvalidCompanyName() { UpdateProfileResponse r = new UpdateProfileResponse(); string Country = "US"; string Language = "ro"; string FirstName = "firstName"; string LastName = "lastName"; bool EmailOffers = true; string PrimaryUse = "Item005"; string City = "city"; string Company = ".HP Inc"; bool ActiveHealth = true; RESTAPICustomerData requestCustData = new RESTAPICustomerData() { Country = Country, Language = Language, FirstName = FirstName, LastName = LastName, EmailOffers = EmailOffers, PrimaryUse = PrimaryUse, City = City, Company = Company, ActiveHealth = ActiveHealth }; ResponseBase response = new ResponseBase(); Assert.IsFalse(requestCustData.IsValid(response)); Assert.AreEqual(response.ErrorList.Count, 1); Assert.AreEqual(response.ErrorList.Where(x => x.DebugStatusText.Contains("Field has invalid format")).Count(), 1); }