示例#1
0
        public void TestNotEquals()
        {
            Version v1 = Version.Parse("1.2");
            Version v2 = Version.Parse("1.1");

            Assert.IsTrue(v1 != v2);
        }
示例#2
0
        public void TestGreaterLessThan()
        {
            Version v1 = Version.Parse("0.1.1.1");
            Version v2 = Version.Parse("1.2");

            Assert.IsTrue(v1 < v2);
            Assert.IsTrue(v2 > v1);
        }
示例#3
0
        public void TestEquals()
        {
            Version v1 = Version.Parse("1.1");
            Version v2 = Version.Parse("1.1");

            Assert.IsTrue(v1 == v2);

            Assert.IsTrue(v1.Equals(v2));
        }
示例#4
0
        public void TestEqualsNull()
        {
            Version v1 = null;
            Version v2 = null;

            Assert.IsTrue(v1 == v2);

            Assert.IsFalse(Version.Parse("1.2.0.0") == null);
            Assert.IsFalse(null == Version.Parse("1.2.0.0"));
        }
示例#5
0
        public void TestParse()
        {
            Version v = Version.Parse("1.1");

            Assert.IsTrue(v.Major == 1 && v.Minor == 1 && v.Revision == 0 && v.Build == 0);

            v = Version.Parse("1.1.2");
            Assert.IsTrue(v.Major == 1 && v.Minor == 1 && v.Revision == 2 && v.Build == 0);

            v = Version.Parse("1.1.2.3");
            Assert.IsTrue(v.Major == 1 && v.Minor == 1 && v.Revision == 2 && v.Build == 3);
        }
示例#6
0
        public void TestGreaterLessAndEqual()
        {
            Assert.IsTrue(Version.Parse("1.2") <= Version.Parse("1.2"));
            Assert.IsTrue(Version.Parse("1.2.1") <= Version.Parse("1.2.1"));
            Assert.IsTrue(Version.Parse("1.2.1.1") <= Version.Parse("1.2.1.1"));

            Assert.IsTrue(Version.Parse("1.2") >= Version.Parse("1.2"));
            Assert.IsTrue(Version.Parse("1.2.1") >= Version.Parse("1.2.1"));
            Assert.IsTrue(Version.Parse("1.2.1.1") >= Version.Parse("1.2.1.1"));

            Assert.IsFalse(Version.Parse("1.2") >= Version.Parse("1.2.1"));
            Assert.IsFalse(Version.Parse("1.2.1") >= Version.Parse("1.2.1.1"));
            Assert.IsFalse(Version.Parse("1.2.1.1") >= Version.Parse("1.2.1.2"));

            Assert.IsTrue(Version.Parse("1.2") <= Version.Parse("1.2.1"));
            Assert.IsTrue(Version.Parse("1.2.1") <= Version.Parse("1.2.1.1"));
            Assert.IsTrue(Version.Parse("1.2.1.1") <= Version.Parse("1.2.1.2"));


            Assert.IsFalse(Version.Parse("1.2.1") <= Version.Parse("1.2"));
            Assert.IsFalse(Version.Parse("1.2.1.1") <= Version.Parse("1.2.1"));
            Assert.IsFalse(Version.Parse("1.2.1.2") <= Version.Parse("1.2.1.1"));
        }
示例#7
0
        public void TestToString()
        {
            Version v1 = Version.Parse("1.2.0.0");

            Assert.IsTrue("1.2.0.0" == v1.ToString());
        }