Utils: Add SplitAddress and SplitName
This commit is contained in:
@ -68,5 +68,37 @@ namespace Tests {
|
||||
Assert.Throws<ArgumentException>(() => Utils.Modulo("789", -1));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_SplitAddress() {
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 1"), Is.EqualTo(("Winzerstra<72>e", "1")));
|
||||
Assert.That(Utils.SplitAddress("Auf dem Feld 12"), Is.EqualTo(("Auf dem Feld", "12")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 5a"), Is.EqualTo(("Winzerstra<72>e", "5a")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 1-3/2"), Is.EqualTo(("Winzerstra<72>e", "1-3/2")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 3/4/5"), Is.EqualTo(("Winzerstra<72>e", "3/4/5")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 7/2/4/77"), Is.EqualTo(("Winzerstra<72>e", "7/2/4/77")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 95b"), Is.EqualTo(("Winzerstra<72>e", "95b")));
|
||||
Assert.That(Utils.SplitAddress("Winzerstra<72>e 1, TOP 3"), Is.EqualTo(("Winzerstra<72>e", "1, TOP 3")));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_SplitName() {
|
||||
Assert.Multiple(() => {
|
||||
Assert.That(Utils.SplitName("Max Bauer", "Bauer"), Is.EqualTo(("Bauer", "Max")));
|
||||
Assert.That(Utils.SplitName("Bauer Max", "Bauer"), Is.EqualTo(("Bauer", "Max")));
|
||||
Assert.That(Utils.SplitName("Max und Moritz Bauer", "Bauer"), Is.EqualTo(("Bauer", "Max und Moritz")));
|
||||
Assert.That(Utils.SplitName("Bauer Max und Moritz", "Bauer"), Is.EqualTo(("Bauer", "Max und Moritz")));
|
||||
Assert.That(Utils.SplitName("Bauer GesbR", "Bauer"), Is.EqualTo(("Bauer", "GesbR")));
|
||||
Assert.That(Utils.SplitName("Max und Moritz Bauer GesbR", "Bauer"), Is.EqualTo(("Bauer", "Max und Moritz GesbR")));
|
||||
Assert.That(Utils.SplitName("Bauer Max und Moritz GesbR", "Bauer"), Is.EqualTo(("Bauer", "Max und Moritz GesbR")));
|
||||
Assert.That(Utils.SplitName("Weingut Bauer", "Bauer"), Is.EqualTo(("Bauer", "Weingut")));
|
||||
Assert.That(Utils.SplitName("Bauer Weingut", "Bauer"), Is.EqualTo(("Bauer", "Weingut")));
|
||||
Assert.That(Utils.SplitName("Max und Moritz Bauer und Mustermann", "Bauer"), Is.EqualTo(("Bauer und Mustermann", "Max und Moritz")));
|
||||
Assert.That(Utils.SplitName("Bauer und Mustermann Max und Moritz", "Bauer"), Is.EqualTo(("Bauer und Mustermann", "Max und Moritz")));
|
||||
Assert.That(Utils.SplitName("ABC GesbR", "Bauer"), Is.EqualTo(((string, string?))("ABC GesbR", null)));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user