Solution restructured to use multiple test projects
This commit is contained in:
66
test/AMWD.Common.Tests/Comparer/VersionStringComparerTest.cs
Normal file
66
test/AMWD.Common.Tests/Comparer/VersionStringComparerTest.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using AMWD.Common.Comparer;
|
||||
|
||||
namespace AMWD.Common.Tests.Comparer
|
||||
{
|
||||
[TestClass]
|
||||
public class VersionStringComparerTest
|
||||
{
|
||||
[DataTestMethod]
|
||||
[DataRow(null, "0")]
|
||||
[DataRow("", "0")]
|
||||
[DataRow("0", "1")]
|
||||
[DataRow("1.0", "1.1")]
|
||||
[DataRow("1.0.0", "1.0.1")]
|
||||
[DataRow("1.0.0.0", "1.0.0.1")]
|
||||
[DataRow("1.0.0.0-RC1", "1.0.0.0-RC2")]
|
||||
public void ShouldBeLessThan(string x, string y)
|
||||
{
|
||||
// Arrange
|
||||
var comparer = new VersionStringComparer();
|
||||
|
||||
// Act
|
||||
int result = comparer.Compare(x, y);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(-1, result);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("0", null)]
|
||||
[DataRow("0", "")]
|
||||
[DataRow("1", "0")]
|
||||
[DataRow("1.1", "1.0")]
|
||||
[DataRow("1.0.1", "1.0.0")]
|
||||
[DataRow("1.0.0.1", "1.0.0.0")]
|
||||
[DataRow("1.0.0.0-RC2", "1.0.0.0-RC1")]
|
||||
public void ShouldBeGreaterThan(string x, string y)
|
||||
{
|
||||
// Arrange
|
||||
var comparer = new VersionStringComparer();
|
||||
|
||||
// Act
|
||||
int result = comparer.Compare(x, y);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(null, null)]
|
||||
[DataRow("", "")]
|
||||
[DataRow("1", "1")]
|
||||
[DataRow("1.2.3", "1.2.3")]
|
||||
[DataRow("1.2.3-alpha", "1.2.3-alpha")]
|
||||
public void ShouldBeEqual(string x, string y)
|
||||
{
|
||||
// Arrange
|
||||
var comparer = new VersionStringComparer();
|
||||
|
||||
// Act
|
||||
int result = comparer.Compare(x, y);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(0, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user