sharee.bike-App/SharedBusinessLogic.Tests/Model/User/Account/TestValidator.cs
2024-04-09 12:53:23 +02:00

30 lines
1 KiB
C#

using NUnit.Framework;
using ShareeBike.Model.User.Account;
namespace SharedBusinessLogic.Tests
{
[TestFixture]
public class TestValidator
{
[Test]
public void TestValidateMailAndPasswordDelegate()
{
Assert.That(Validator.ValidateMailAndPasswordDelegate(null, null).ValidElement, Is.EqualTo(Elements.None));
Assert.That(Validator.ValidateMailAndPasswordDelegate("", null).ValidElement, Is.EqualTo(Elements.None));
Assert.That(Validator.ValidateMailAndPasswordDelegate("a", null).ValidElement, Is.EqualTo(Elements.None));
Assert.That(Validator.ValidateMailAndPasswordDelegate("a@", null).ValidElement, Is.EqualTo(Elements.None));
Assert.That(Validator.ValidateMailAndPasswordDelegate("a@c", "").ValidElement, Is.EqualTo(Elements.Mail));
Assert.That(Validator.ValidateMailAndPasswordDelegate("a@c", "123").ValidElement, Is.EqualTo(Elements.Mail));
Assert.That(Validator.ValidateMailAndPasswordDelegate("a@c", "123456789" /* password */).ValidElement, Is.EqualTo(Elements.Mail | Elements.Password));
}
}
}