public void Input_WithIdAndVersion_ReturnsConversion() { var node = CreateXmlNode("id", "1.0"); var value = XmlDependencyConverter.Convert(node); Assert.IsNotNull(value); }
public void Conversion_ForId_AsExpected() { var node = CreateXmlNode("packageX", "1.2"); var dependency = XmlDependencyConverter.Convert(node); Assert.AreEqual("packageX", dependency.Name); Assert.AreEqual("1.2", dependency.Version); Assert.IsNotNull(dependency); }
public void Input_WithoutVersion_ReturnsNull() { var doc = new XmlDocument(); var node = doc.CreateElement("dependency"); node.SetAttribute("id", "bla"); var value = XmlDependencyConverter.Convert(node); Assert.IsNull(value); }
public void VersionConversion_SingleVersion_AtLeast() { var node = CreateXmlNode("packageX", "1.2.3"); var dependency = XmlDependencyConverter.Convert(node); Assert.AreEqual(1, dependency.MinVersion.Major); Assert.AreEqual(2, dependency.MinVersion.Minor); Assert.AreEqual(3, dependency.MinVersion.Bugfix); Assert.IsTrue(dependency.MinVersion.Inclusive); Assert.IsNull(dependency.MaxVersion); }
public void Input_WithVersionPreTag_ReturnsCorrectVersion() { var node = CreateXmlNode("id", "1.2.3-pre12"); var value = XmlDependencyConverter.Convert(node); Assert.IsNotNull(value); Assert.AreEqual(1, value.MinVersion.Major); Assert.AreEqual(2, value.MinVersion.Minor); Assert.AreEqual(3, value.MinVersion.Bugfix); Assert.AreEqual("pre12", value.MinVersion.Tag); }
public void VersionConversion_Ranges_NoMin_ExlusiveMax() { var node = CreateXmlNode("packageX", "(,1.0)"); var dependency = XmlDependencyConverter.Convert(node); Assert.IsNull(dependency.MinVersion); Assert.AreEqual(1, dependency.MaxVersion.Major); Assert.AreEqual(0, dependency.MaxVersion.Minor); Assert.AreEqual(0, dependency.MaxVersion.Bugfix); Assert.AreEqual(false, dependency.MaxVersion.Inclusive); }
public void VersionConversion_Ranges_ExactRange_NoInclusion() { var node = CreateXmlNode("packageX", "(1.0, 2.0)"); var dependency = XmlDependencyConverter.Convert(node); Assert.IsNotNull(dependency.MinVersion); Assert.IsNotNull(dependency.MaxVersion); Assert.AreEqual(1, dependency.MinVersion.Major); Assert.AreEqual(0, dependency.MinVersion.Minor); Assert.AreEqual(0, dependency.MinVersion.Bugfix); Assert.AreEqual(2, dependency.MaxVersion.Major); Assert.AreEqual(0, dependency.MaxVersion.Minor); Assert.AreEqual(0, dependency.MaxVersion.Bugfix); Assert.IsFalse(dependency.MinVersion.Inclusive); Assert.IsFalse(dependency.MaxVersion.Inclusive); }
public void VersionConversion_Ranges_MissingBracesOnEnd_ThrowsExecption() { var node = CreateXmlNode("packageX", "(1.0, 2.0"); XmlDependencyConverter.Convert(node); }
public void Input_WithNullNode_RaisesException() { XmlDependencyConverter.Convert(null); }