public void ShouldThrowExceptionWhenXmlCannotBevalidated() { string testXMLPath = Path.GetFullPath(TestDataPath + "SMDConfiguration_.xml"); string testXSDPath = Path.GetFullPath(TestDataPath + "SMDConfiguration.xsd"); string configDirectory = Path.GetFullPath(@"..\..\..\Configuration\"); ConfigurationManager.AppSettings.Set(@"AppFolder.Configuration", configDirectory); Log4NetLogger logger = new Log4NetLogger("CameraTest"); SettingsXmlLoader loader = new SettingsXmlLoader(testXMLPath, testXSDPath, logger); SettingsTO settingsTO = new SettingsTO(); Assert.ThrowsException<XmlSchemaValidationException>( new Action(() => { loader.LoadSettingsTO(settingsTO); }), "The XML document does not match the XSD");
code to explanationMon, 17 Apr 2023