Using NUnit instead of MSTest
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
using Elwig.Helpers;
|
||||
|
||||
namespace Tests {
|
||||
[TestClass]
|
||||
[TestFixture]
|
||||
public class HelpersUtilsTest {
|
||||
|
||||
private static readonly double[,] Gradation = new double[,] {
|
||||
@ -15,28 +15,28 @@ namespace Tests {
|
||||
{ 30.0, 156.0 },
|
||||
};
|
||||
|
||||
[TestMethod]
|
||||
[Test]
|
||||
public void Test_KmwToOe() {
|
||||
for (int i = 0; i < Gradation.GetLength(0); i++) {
|
||||
Assert.AreEqual(Gradation[i, 1], Utils.KmwToOe(Gradation[i, 0]));
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Test]
|
||||
public void Test_OeToKmw() {
|
||||
for (int i = 0; i < Gradation.GetLength(0); i++) {
|
||||
Assert.AreEqual(Gradation[i, 0], Utils.OeToKmw(Gradation[i, 1]));
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Test]
|
||||
public void Test_DecFromDb() {
|
||||
Assert.AreEqual(10.67M, Utils.DecFromDb(10670, 3));
|
||||
Assert.AreEqual(-100.9999M, Utils.DecFromDb(-1009999, 4));
|
||||
Assert.AreEqual(0.01M, Utils.DecFromDb(1, 2));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Test]
|
||||
public void Test_DecToDb() {
|
||||
Assert.AreEqual(21948, Utils.DecToDb(219.48M, 2));
|
||||
Assert.AreEqual(-12345, Utils.DecToDb(-1.2345M, 4));
|
||||
@ -45,18 +45,18 @@ namespace Tests {
|
||||
Assert.AreEqual(-561894, Utils.DecToDb(-5618.944M, 2));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Test]
|
||||
public void Test_Modulo() {
|
||||
Assert.AreEqual(1, Utils.Modulo("1", 2));
|
||||
Assert.AreEqual(1, Utils.Modulo("12", 11));
|
||||
Assert.AreEqual(1, Utils.Modulo("65", 16));
|
||||
Assert.AreEqual(4, Utils.Modulo("91746381048364", 10));
|
||||
Assert.AreEqual(1, Utils.Modulo("210501700012345678131468", 97));
|
||||
Assert.ThrowsException<ArgumentException>(() => Utils.Modulo("", 4));
|
||||
Assert.ThrowsException<ArgumentException>(() => Utils.Modulo("1ab", 5));
|
||||
Assert.ThrowsException<ArgumentException>(() => Utils.Modulo("123", 1));
|
||||
Assert.ThrowsException<ArgumentException>(() => Utils.Modulo("456", 0));
|
||||
Assert.ThrowsException<ArgumentException>(() => Utils.Modulo("789", -1));
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("", 4));
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("1ab", 5));
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("123", 1));
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("456", 0));
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("789", -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user