1
0

Solution restructured to use multiple test projects

This commit is contained in:
2024-07-04 18:22:26 +02:00
parent 508379d704
commit df6763b99b
144 changed files with 387 additions and 1693 deletions

View 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);
}
}
}