public void TestParseX12WithValidationFailure() { // ARRANGE const string sample = "EdiFabric.Tests.Edi.X12_810_00204.txt"; // ACT var message = TestHelper.ParseX12(sample).OfType <M_810>().Single(); var validationResults = EdiValidator.Create("EdiFabric.Xsd").Validate(message); // ASSERT Assert.IsNotNull(validationResults); Assert.IsNotNull(validationResults.ErrorContext); Assert.IsTrue(validationResults.ErrorContext.Errors.Any() || validationResults.ErrorContext.Codes.Any()); }
public void TestParseEdifactWithValidation() { // ARRANGE const string sample = "EdiFabric.Tests.Edi.Edifact_INVOIC_D00A_Valid.txt"; // ACT var message = TestHelper.ParseEdifact(sample).OfType <M_INVOIC>().Single(); var validationResults = EdiValidator.Create("EdiFabric.Xsd").Validate(message); // ASSERT Assert.IsNotNull(validationResults); Assert.IsNotNull(validationResults.ErrorContext); Assert.IsFalse(validationResults.ErrorContext.Errors.Any()); Assert.IsFalse(validationResults.ErrorContext.Codes.Any()); }
public void TestValidationRules() { // ARRANGE const string sample = "EdiFabric.Tests.Xml.X12_810_00204_Validation.xml"; var obj = TestHelper.Deserialize <Rules.Rep.X12002040810.M_810>(TestHelper.Load(sample)); const string expectedResult = "EdiFabric.Tests.Xml.X12_810_00204_ValidationExpected.xml"; var expectedXml = XElement.Load(TestHelper.Load(expectedResult)); // ACT var error = EdiValidator.Create("EdiFabric.Xsd").Validate(obj); // ASSERT Assert.IsNotNull(error); var root = TestHelper.Serialize(error.Flatten().ToList()).Root; Assert.IsNotNull(root); Assert.AreEqual(root.ToString(), expectedXml.ToString()); }