mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 15:16:34 +01:00
41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using System.Threading.Tasks;
|
|
using ShareeBike.Model.User.Account;
|
|
|
|
namespace SharedBusinessLogic.Tests.Framework.Model.User.Account
|
|
{
|
|
public class StoreMock : IStore
|
|
{
|
|
IAccount m_oAccount;
|
|
|
|
/// <summary>
|
|
/// Instantiates
|
|
/// - a dummy account to simulate a logged in user before end of last session
|
|
/// - an empty account to simulate no user logged in before end of last session
|
|
/// </summary>
|
|
/// <param name="p_oAccount">If null no user is logged in.</param>
|
|
public StoreMock(IAccount p_oAccount = null)
|
|
{
|
|
m_oAccount = new ShareeBike.Model.User.Account.Account(p_oAccount ?? new EmptyAccount());
|
|
}
|
|
|
|
public Task<IAccount> Load()
|
|
{
|
|
return Task.FromResult<IAccount>(new ShareeBike.Model.User.Account.Account(m_oAccount));
|
|
}
|
|
|
|
public IAccount Delete(IAccount p_oAccount)
|
|
{
|
|
// Set member to empty.
|
|
m_oAccount = new EmptyAccount();
|
|
|
|
// Return empty account.
|
|
return new EmptyAccount();
|
|
}
|
|
|
|
public Task Save(IAccount p_oAccount)
|
|
{
|
|
m_oAccount = new ShareeBike.Model.User.Account.Account(p_oAccount);
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|