[TestMethod()]//check modelstate if valid credentials are passed public void GetValidationErrorMessagesTestForValidModel() { //Arrange AvaTaxProfileAssistantHelperTests taxProfileAsstHelper = new AvaTaxProfileAssistantHelperTests(); TryValidateModel(input.AccountCredentials); string ErrorString = ""; //Act AvaTaxProfileAssistantHelper.GetValidationErrorMessages(ModelState, ref ErrorString); //Assert Assert.IsTrue(ModelState.IsValid, "Model state cannot be false when valid credentials are passed!!"); }
[TestMethod()]//check modelstate and if false return errorstring public void GetValidationErrorMessagesTestForInvalidModel() { //Arrange xmlReader = XmlReader.Create(@"..\XMLTestFiles\TPA_1000_AccountCredentialsMissing.xml"); var tpa = new TPAScaffold(); var serializer = new XmlSerializer(tpa.GetType()); input = (TPAScaffold)serializer.Deserialize(xmlReader); AvaTaxProfileAssistantHelperTests taxProfileAsstHelper = new AvaTaxProfileAssistantHelperTests(); TryValidateModel(input.AccountCredentials); string ErrorString = ""; //Act AvaTaxProfileAssistantHelper.GetValidationErrorMessages(ModelState, ref ErrorString); //Assert Assert.AreEqual(false, ModelState.IsValid, "Model state cannot be true when invalid credentials are passed!!"); }