Using NUnit instead of MSTest

This commit is contained in:
2023-04-26 22:14:39 +02:00
parent d6059e724b
commit 6acdbee154
6 changed files with 52 additions and 25 deletions

View File

@ -0,0 +1,26 @@
using Elwig.Helpers;
using System.Windows.Controls;
namespace Tests {
[TestFixture]
[Apartment(ApartmentState.STA)]
public class HelpersValidatorTest {
private static TextBox CreateTextBox(string value, int caret = 0) {
return new() {
Text = value,
CaretIndex = caret,
};
}
[Test]
public void Test_CheckInteger_Simple() {
Assert.IsFalse(Validator.CheckInteger(CreateTextBox(""), true).IsValid);
Assert.IsTrue(Validator.CheckInteger(CreateTextBox(""), false).IsValid);
Assert.IsTrue(Validator.CheckInteger(CreateTextBox("123"), true).IsValid);
Assert.IsTrue(Validator.CheckInteger(CreateTextBox("456"), false).IsValid);
Assert.IsTrue(Validator.CheckInteger(CreateTextBox("1234"), false, 4).IsValid);
Assert.IsTrue(Validator.CheckInteger(CreateTextBox("4567"), false, 3).IsValid);
}
}
}