80 instantiations of SimpleVersion
Microsoft.Build (1)
Utilities\SimpleVersion.cs (1)
125return new SimpleVersion(major, minor, build, revision);
Microsoft.Build.Engine.UnitTests (79)
Evaluation\SimpleVersion_Tests.cs (79)
18VerifyVersion(new SimpleVersion(), 0, 0, 0, 0); 27VerifyVersion(new SimpleVersion(major), major, 0, 0, 0); 36VerifyVersion(new SimpleVersion(major, minor), major, minor, 0, 0); 45VerifyVersion(new SimpleVersion(major, minor, build), major, minor, build, 0); 61VerifyVersion(new SimpleVersion(major, minor, build, revision), major, minor, build, revision); 67Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0)); 68Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0, 0)); 69Assert.Throws<ArgumentOutOfRangeException>("major", () => new SimpleVersion(-1, 0, 0, 0)); 75Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1)); 76Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1, 0)); 77Assert.Throws<ArgumentOutOfRangeException>("minor", () => new SimpleVersion(0, -1, 0, 0)); 83Assert.Throws<ArgumentOutOfRangeException>("build", () => new SimpleVersion(0, 0, -1)); 84Assert.Throws<ArgumentOutOfRangeException>("build", () => new SimpleVersion(0, 0, -1, 0)); 90Assert.Throws<ArgumentOutOfRangeException>("revision", () => new SimpleVersion(0, 0, 0, -1)); 97(new SimpleVersion(1, 2), new SimpleVersion(1, 2), 0), 98(new SimpleVersion(1, 2), new SimpleVersion(1, 3), -1), 99(new SimpleVersion(1, 2), new SimpleVersion(1, 1), 1), 100(new SimpleVersion(1, 2), new SimpleVersion(2, 0), -1), 101(new SimpleVersion(1, 2), new SimpleVersion(1, 2, 1), -1), 102(new SimpleVersion(1, 2), new SimpleVersion(1, 2, 0, 1), -1), 103(new SimpleVersion(1, 2), new SimpleVersion(1, 0), 1), 104(new SimpleVersion(1, 2), new SimpleVersion(1, 0, 1), 1), 105(new SimpleVersion(1, 2), new SimpleVersion(1, 0, 0, 1), 1), 107(new SimpleVersion(3, 2, 1), new SimpleVersion(2, 2, 1), 1), 108(new SimpleVersion(3, 2, 1), new SimpleVersion(3, 1, 1), 1), 109(new SimpleVersion(3, 2, 1), new SimpleVersion(3, 2, 0), 1), 111(new SimpleVersion(1, 2, 3, 4), new SimpleVersion(1, 2, 3, 4), 0), 112(new SimpleVersion(1, 2, 3, 4), new SimpleVersion(1, 2, 3, 5), -1), 113(new SimpleVersion(1, 2, 3, 4), new SimpleVersion(1, 2, 3, 3), 1) 170yield return new object[] { new SimpleVersion(2, 3), new SimpleVersion(2, 3), true }; 171yield return new object[] { new SimpleVersion(2, 3), new SimpleVersion(2, 4), false }; 172yield return new object[] { new SimpleVersion(2, 3), new SimpleVersion(3, 3), false }; 174yield return new object[] { new SimpleVersion(2, 3, 4), new SimpleVersion(2, 3, 4), true }; 175yield return new object[] { new SimpleVersion(2, 3, 4), new SimpleVersion(2, 3, 5), false }; 176yield return new object[] { new SimpleVersion(2, 3, 4), new SimpleVersion(2, 3), false }; 178yield return new object[] { new SimpleVersion(2, 3, 4, 5), new SimpleVersion(2, 3, 4, 5), true }; 179yield return new object[] { new SimpleVersion(2, 3, 4, 5), new SimpleVersion(2, 3, 4, 6), false }; 180yield return new object[] { new SimpleVersion(2, 3, 4, 5), new SimpleVersion(2, 3), false }; 181yield return new object[] { new SimpleVersion(2, 3, 4, 5), new SimpleVersion(2, 3, 4), false }; 183yield return new object[] { new SimpleVersion(2, 3, 0), new SimpleVersion(2, 3), true }; 184yield return new object[] { new SimpleVersion(2, 3, 4, 0), new SimpleVersion(2, 3, 4), true }; 186yield return new object[] { new SimpleVersion(2, 3, 4, 5), new TimeSpan(), false }; 187yield return new object[] { new SimpleVersion(2, 3, 4, 5), null, false }; 217yield return new object[] { $"{prefix}1{suffix}", new SimpleVersion(1) }; 218yield return new object[] { $"{prefix}1.2{suffix}", new SimpleVersion(1, 2) }; 219yield return new object[] { $"{prefix}1.2.3{suffix}", new SimpleVersion(1, 2, 3) }; 220yield return new object[] { $"{prefix}1.2.3.4{suffix}", new SimpleVersion(1, 2, 3, 4) }; 221yield return new object[] { $"{prefix}2147483647.2147483647.2147483647.2147483647{suffix}", new SimpleVersion(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue) }; 285yield return new object[] { new SimpleVersion(1), "1.0.0.0" }; 286yield return new object[] { new SimpleVersion(1, 2), "1.2.0.0" }; 287yield return new object[] { new SimpleVersion(1, 2, 3), "1.2.3.0" }; 288yield return new object[] { new SimpleVersion(1, 2, 3, 4), "1.2.3.4" };
49 references to SimpleVersion
Microsoft.Build (30)
Evaluation\IntrinsicFunctions.cs (12)
565return SimpleVersion.Parse(a) == SimpleVersion.Parse(b); 570return SimpleVersion.Parse(a) != SimpleVersion.Parse(b); 575return SimpleVersion.Parse(a) > SimpleVersion.Parse(b); 580return SimpleVersion.Parse(a) >= SimpleVersion.Parse(b); 585return SimpleVersion.Parse(a) < SimpleVersion.Parse(b); 590return SimpleVersion.Parse(a) <= SimpleVersion.Parse(b);
Utilities\SimpleVersion.cs (18)
42internal readonly struct SimpleVersion : IEquatable<SimpleVersion>, IComparable<SimpleVersion> 77public bool Equals(SimpleVersion other) 85public int CompareTo(SimpleVersion other) 94public override bool Equals(object obj) => obj is SimpleVersion v && Equals(v); 98public static bool operator ==(SimpleVersion a, SimpleVersion b) => a.Equals(b); 99public static bool operator !=(SimpleVersion a, SimpleVersion b) => !a.Equals(b); 100public static bool operator <(SimpleVersion a, SimpleVersion b) => a.CompareTo(b) < 0; 101public static bool operator <=(SimpleVersion a, SimpleVersion b) => a.CompareTo(b) <= 0; 102public static bool operator >(SimpleVersion a, SimpleVersion b) => a.CompareTo(b) > 0; 103public static bool operator >=(SimpleVersion a, SimpleVersion b) => a.CompareTo(b) >= 0; 105public static SimpleVersion Parse(string input)
Microsoft.Build.Engine.UnitTests (19)
Evaluation\SimpleVersion_Tests.cs (19)
95foreach (var input in new (SimpleVersion v1, SimpleVersion v2, int expectedSign)[] 125var version1 = (SimpleVersion)version1Object; 126var version2 = (SimpleVersion)version2Object; 128Assert.Equal(expectedSign, Comparer<SimpleVersion>.Default.Compare(version1, version2)); 136var version1 = (SimpleVersion)version1Object; 137var version2 = (SimpleVersion)version2Object; 194var version1 = (SimpleVersion)version1Object; 196if (version2Object is SimpleVersion version2) 230Assert.Equal(expected, SimpleVersion.Parse(input)); 280Assert.Throws(exceptionType, () => SimpleVersion.Parse(input)); 295var version = (SimpleVersion)versionObject; 300private static void VerifyVersion(SimpleVersion version, int major, int minor, int build, int revision)