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

58 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using NUnit.Framework;
namespace UITest.Fixtures.ObjectTests.User.Account
{
[TestFixture]
public class TestAccount
{
[Test]
public void TestConstruct()
{
// Act
var account = new ShareeBike.Model.User.Account.Account(
"hans.musterman@hotmail.com", // Mail
"myPasswd", // Pwd
false,
"aktuellerKeks", // Cookie
new List<string> { "Honkey", "Tonkey" }, // Group
ShareeBike.Model.User.Account.Permissions.None);
// Assert
Assert.That(account.Mail, Is.EqualTo("hans.musterman@hotmail.com"));
Assert.That(account.Pwd, Is.EqualTo("myPasswd"));
Assert.That(account.IsAgbAcknowledged, Is.False);
Assert.That(account.SessionCookie, Is.EqualTo("aktuellerKeks"));
Assert.That(String.Join(",", account.Group), Is.EqualTo("Honkey,Tonkey"));
Assert.That(account.DebugLevel, Is.EqualTo(ShareeBike.Model.User.Account.Permissions.None));
}
[Test]
public void TestConstruct_Copy()
{
var account = new ShareeBike.Model.User.Account.Account(new ShareeBike.Model.User.Account.Account(
"a@b",
"112",
true, // Agbs have been acknowledged
"3330",
new List<string> { "Honkey", "Tonkey" },
ShareeBike.Model.User.Account.Permissions.None));
Assert.That(account.Mail, Is.EqualTo("a@b"));
Assert.That(account.Pwd, Is.EqualTo("112"));
Assert.That(account.IsAgbAcknowledged, Is.True);
Assert.That(account.SessionCookie, Is.EqualTo("3330"));
Assert.That(String.Join(",", account.Group), Is.EqualTo("Honkey,Tonkey"));
Assert.That(account.DebugLevel, Is.EqualTo(ShareeBike.Model.User.Account.Permissions.None));
}
[Test]
public void TestConstruct_InvalidGroup()
{
Assert.Throws<ArgumentException>(() => new ShareeBike.Model.User.Account.Account("a@b", "112", false, "3330", null, ShareeBike.Model.User.Account.Permissions.None));
Assert.Throws<ArgumentException>(() => new ShareeBike.Model.User.Account.Account(null));
}
}
}