mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 18:46:30 +01:00
85 lines
2.9 KiB
C#
85 lines
2.9 KiB
C#
|
using NUnit.Framework;
|
|||
|
using Rhino.Mocks;
|
|||
|
using TINK.Model.Connector;
|
|||
|
using TINK.Model.Services.CopriApi;
|
|||
|
|
|||
|
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestConnector
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Verifies that factory method returns correcty type depending on session cookie.
|
|||
|
/// </summary>
|
|||
|
[Test]
|
|||
|
public void TestCommandFactory()
|
|||
|
{
|
|||
|
var l_oCopri = MockRepository.GenerateStub<ICachedCopriServer>();
|
|||
|
|
|||
|
// Construct not logged in version of connector.
|
|||
|
var l_oCommand = new TINK.Model.Connector.Connector(
|
|||
|
new System.Uri("http://1.2.3.4"),
|
|||
|
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default automated test envirnoment",
|
|||
|
"", // Not logged in
|
|||
|
"",
|
|||
|
server: 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<ICachedCopriServer>();
|
|||
|
|
|||
|
var l_oCommand = new TINK.Model.Connector.Connector(
|
|||
|
new System.Uri("http://1.2.3.4"),
|
|||
|
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default automated test envirnoment",
|
|||
|
"123", // Logged in
|
|||
|
"a@b",
|
|||
|
server: 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<ICachedCopriServer>();
|
|||
|
|
|||
|
var l_oQuery = new TINK.Model.Connector.Connector(
|
|||
|
new System.Uri("http://1.2.3.4"),
|
|||
|
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default automated test envirnoment",
|
|||
|
"",
|
|||
|
"",
|
|||
|
server: l_oCopri).Query;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(CachedQuery), 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<ICachedCopriServer>();
|
|||
|
|
|||
|
var l_oQuery = new TINK.Model.Connector.Connector(
|
|||
|
new System.Uri("http://1.2.3.4"),
|
|||
|
"TestTINKApp/3.0.127 AutomatedTestEnvirnoment/Default automated test envirnoment",
|
|||
|
"123",
|
|||
|
"a@b",
|
|||
|
server: l_oCopri).Query;
|
|||
|
|
|||
|
Assert.AreEqual(typeof(CachedQueryLoggedIn), l_oQuery.GetType());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|