예제 #1
0
        public void Input_WithIdAndVersion_ReturnsConversion()
        {
            var node = CreateXmlNode("id", "1.0");

            var value = XmlDependencyConverter.Convert(node);

            Assert.IsNotNull(value);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        public void VersionConversion_Ranges_MissingBracesOnEnd_ThrowsExecption()
        {
            var node = CreateXmlNode("packageX", "(1.0, 2.0");

            XmlDependencyConverter.Convert(node);
        }
예제 #9
0
 public void Input_WithNullNode_RaisesException()
 {
     XmlDependencyConverter.Convert(null);
 }