Using NUnit instead of MSTest
This commit is contained in:
@ -5,7 +5,7 @@ using System.Windows.Controls;
|
||||
using Elwig.Models;
|
||||
|
||||
namespace Elwig.Helpers {
|
||||
static class Validator {
|
||||
public static class Validator {
|
||||
|
||||
private static readonly Dictionary<string, string[][]> PHONE_NRS = new() {
|
||||
{ "43", new string[][] {
|
||||
@ -31,10 +31,10 @@ namespace Elwig.Helpers {
|
||||
};
|
||||
|
||||
public static ValidationResult CheckInteger(TextBox input, bool required) {
|
||||
return CheckNumeric(input, required, -1);
|
||||
return CheckInteger(input, required, -1);
|
||||
}
|
||||
|
||||
private static ValidationResult CheckNumeric(TextBox input, bool required, int maxLen) {
|
||||
public static ValidationResult CheckInteger(TextBox input, bool required, int maxLen) {
|
||||
string text = "";
|
||||
int pos = input.CaretIndex;
|
||||
for (int i = 0; i < input.Text.Length; i++) {
|
||||
@ -60,7 +60,7 @@ namespace Elwig.Helpers {
|
||||
}
|
||||
|
||||
public static ValidationResult CheckPlz(TextBox input, bool required, AppDbContext ctx) {
|
||||
CheckNumeric(input, false, 4);
|
||||
CheckInteger(input, false, 4);
|
||||
if (!required && input.Text.Length == 0) {
|
||||
return new(true, null);
|
||||
} else if (input.Text.Length != 4) {
|
||||
@ -237,7 +237,7 @@ namespace Elwig.Helpers {
|
||||
}
|
||||
|
||||
public static ValidationResult CheckLfbisNr(TextBox input, bool required) {
|
||||
var res = CheckNumeric(input, false, 7);
|
||||
var res = CheckInteger(input, false, 7);
|
||||
if (!res.IsValid) {
|
||||
return res;
|
||||
} else if (!required && input.Text.Length == 0) {
|
||||
|
Reference in New Issue
Block a user