mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-24 16:16:27 +01:00
77 lines
2.2 KiB
C#
77 lines
2.2 KiB
C#
|
using NUnit.Framework;
|
|||
|
using Rhino.Mocks;
|
|||
|
using TINK.Model.Connector;
|
|||
|
using TINK.Repository;
|
|||
|
|
|||
|
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestConnectorCache
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Verifies that factory method returns correcty type depending on session cookie.
|
|||
|
/// </summary>
|
|||
|
[Test]
|
|||
|
public void TestCommandFactory()
|
|||
|
{
|
|||
|
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
|||
|
|
|||
|
// Construct not logged in version of connector.
|
|||
|
var l_oCommand = new ConnectorCache(
|
|||
|
"", // Not logged in
|
|||
|
"",
|
|||
|
l_oCopri).Command;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(Command), l_oCommand.GetType());
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Verifies that factory method returns correcty type depending on session cookie.
|
|||
|
/// </summary>
|
|||
|
[Test]
|
|||
|
public void TestCommandFactory_LoggedIn()
|
|||
|
{
|
|||
|
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
|||
|
|
|||
|
var l_oCommand = new ConnectorCache(
|
|||
|
"123", // Logged in
|
|||
|
"a@b",
|
|||
|
l_oCopri).Command;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(CommandLoggedIn), l_oCommand.GetType());
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Verifies that factory method returns correcty type depending on session cookie.
|
|||
|
/// </summary>
|
|||
|
[Test]
|
|||
|
public void TestQueryFactory_CachedServer()
|
|||
|
{
|
|||
|
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
|||
|
|
|||
|
var l_oQuery = new ConnectorCache(
|
|||
|
"",
|
|||
|
"",
|
|||
|
l_oCopri).Query;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(TINK.Model.Connector.Query), l_oQuery.GetType());
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Verifies that factory method returns correcty type depending on session cookie.
|
|||
|
/// </summary>
|
|||
|
[Test]
|
|||
|
public void TestQueryFactory_LoggedIn()
|
|||
|
{
|
|||
|
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
|||
|
|
|||
|
var l_oQuery = new ConnectorCache(
|
|||
|
"123",
|
|||
|
"a@b",
|
|||
|
l_oCopri).Query;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(QueryLoggedIn), l_oQuery.GetType());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|