Using NUnit instead of MSTest
This commit is contained in:
26
Tests/HelpersValidatorTest.cs
Normal file
26
Tests/HelpersValidatorTest.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user