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