Version 3.0.270

This commit is contained in:
Oliver Hauff 2022-01-04 18:59:16 +01:00
parent 67999ef4ae
commit e0c75d5b37
81 changed files with 812 additions and 474 deletions

View file

@ -14,6 +14,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
var account = new TINK.Model.User.Account.Account(
"hans.musterman@hotmail.com", // Mail
"myPasswd", // Pwd
false,
"aktuellerKeks", // Cookie
new List<string> { "Honkey", "Tonkey" }, // Group
TINK.Model.User.Account.Permissions.None);
@ -21,6 +22,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
// Assert
Assert.AreEqual("hans.musterman@hotmail.com", account.Mail);
Assert.AreEqual("myPasswd", account.Pwd);
Assert.That(account.IsAgbAcknowledged, Is.False);
Assert.AreEqual("aktuellerKeks", account.SessionCookie);
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
@ -29,19 +31,26 @@ namespace UITest.Fixtures.ObjectTests.User.Account
[Test]
public void TestConstruct_Copy()
{
var l_oAccount = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account("a@b", "112", "3330", new List<string> { "Honkey", "Tonkey" },TINK.Model.User.Account.Permissions.None));
var account = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account(
"a@b",
"112",
true, // Agbs have been acknowledged
"3330",
new List<string> { "Honkey", "Tonkey" },
TINK.Model.User.Account.Permissions.None));
Assert.AreEqual("a@b", l_oAccount.Mail);
Assert.AreEqual("112", l_oAccount.Pwd);
Assert.AreEqual("3330", l_oAccount.SessionCookie);
Assert.AreEqual("Honkey,Tonkey", String.Join(",", l_oAccount.Group));
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, l_oAccount.DebugLevel);
Assert.AreEqual("a@b", account.Mail);
Assert.AreEqual("112", account.Pwd);
Assert.That(account.IsAgbAcknowledged, Is.False);
Assert.AreEqual("3330", account.SessionCookie);
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
}
[Test]
public void TestConstruct_InvalidGroup()
{
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", "3330", null, TINK.Model.User.Account.Permissions.None));
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", false, "3330", null, TINK.Model.User.Account.Permissions.None));
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account(null));
}

View file

@ -8,6 +8,8 @@ using TINK.Repository;
using static TINK.Repository.CopriCallsMemory;
using TestFramework.Model.User.Account;
using System;
using System.Threading.Tasks;
namespace TestTINKLib
{
@ -18,11 +20,11 @@ namespace TestTINKLib
[Test]
public void TestConstruct_NotLoggedIn_NoUsername()
{
var l_oStoreMock = new StoreMock(); // Account without user name, password and cookie
var storeMock = new StoreMock(); // Account without user name, password and cookie
var l_oUser = new User(
l_oStoreMock,
l_oStoreMock.Load().Result,
storeMock,
storeMock.Load().Result,
"HwId1000000000000");
Assert.IsFalse(l_oUser.IsLoggedIn);
@ -34,23 +36,23 @@ namespace TestTINKLib
[Test]
public void TestConstruct_NotLoggedIn_NoCookie()
{
var l_oStoreMock = new StoreMock(new Account("John", "123", null, new List<string>())); // Account without session cookie.
var storeMock = new StoreMock(new Account("John", "123", true, null, new List<string>())); // Account without session cookie.
var l_oUser = new User(
l_oStoreMock,
l_oStoreMock.Load().Result,
var user = new User(
storeMock,
storeMock.Load().Result,
"123456789");
Assert.IsFalse(l_oUser.IsLoggedIn);
Assert.AreEqual("John", l_oUser.Mail);
Assert.AreEqual("123", l_oUser.Password);
Assert.IsNull(l_oUser.SessionCookie);
Assert.IsFalse(user.IsLoggedIn);
Assert.AreEqual("John", user.Mail);
Assert.AreEqual("123", user.Password);
Assert.IsNull(user.SessionCookie);
}
[Test]
public void TestConstruct_LoggedIn()
{
var l_oStoreMock = new StoreMock(new Account("John", "123", "9512", new List<string> { "TINK" }));
var l_oStoreMock = new StoreMock(new Account("John", "123", false, "9512", new List<string> { "TINK" }));
var l_oUser = new User(
l_oStoreMock,
@ -66,9 +68,10 @@ namespace TestTINKLib
/// <summary>Test logging in. </summary>
[Test]
public void TestSetCredentials()
public async Task TestSetCredentials()
{
var l_oConnector = new ConnectorCache(
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
string.Empty,
string.Empty,
new CopriCallsMemory(SampleSets.Set2, 1));
@ -88,7 +91,7 @@ namespace TestTINKLib
LoginSessionCopriInfo.JavaministerHardwareNr1.Pwd,
l_oUser.DeviceId).Result;
l_oUser.Login(l_oAccount);
await l_oUser.Login(l_oAccount);
Assert.IsTrue(l_oUser.IsLoggedIn);
Assert.AreEqual(LoginSessionCopriInfo.JavaministerHardwareNr1.Mail, l_oUser.Mail);