public void Empty() { var document = new ExternalModulesDocument(); var result = document.ReadModules(); Assert.That(result, Is.Not.Null); Assert.That(result, Is.Empty); }
public ExternalModules(string path) { _path = path; Items = new List <ExternalModule>(); _storageIsExists = File.Exists(path); if (_storageIsExists) { try { _doc = new ExternalModulesDocument(_path); } catch (System.Xml.XmlException) { _doc = new ExternalModulesDocument(); } } else { _doc = new ExternalModulesDocument(); } }
public void Simple() { var xdoc = new XDocument( new XDeclaration("1.0", "us-utf8", null), new XElement("modules", new XElement("module", new XElement("groupId", "a"), new XElement("artifactId", "b"), new XElement("version", "c") ) ) ); var document = new ExternalModulesDocument(xdoc); var result = document.ReadModules(); Assert.That(result, Is.Not.Null); var module = result.Single(); Assert.That(module.GroupId, Is.EqualTo("a")); Assert.That(module.ArtifactId, Is.EqualTo("b")); Assert.That(module.Version.Value, Is.EqualTo("c")); }