public void WiftConnector_StartSession_Creates_Wift_Session_Fail()
        {
            var mockConfig = new Mock <IConfigurationRoot>();

            mockConfig.SetupGet(x => x[It.IsAny <string>()]).Returns("testvalue");

            var mockWift       = new Mock <IWift>();
            var statusNotFound = HttpStatusCode.NotFound;

            mockWift.Setup(x => x.CreateSession(
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <WiftSessionOptions>(),
                               out statusNotFound
                               ))
            .Returns(default(WiftSession));

            var sut = new WiftConnector(
                mockWift.Object,
                mockConfig.Object
                );

            var ssResult = sut.StartSession();

            Assert.AreEqual(ssResult, false);
        }
        public void WiftConnector_StartSession_Creates_Wift_Session_Success()
        {
            var mockConfig = new Mock <IConfigurationRoot>();

            mockConfig.SetupGet(x => x[It.IsAny <string>()]).Returns("testvalue");

            var mockWift = new Mock <IWift>();
            var statusOK = HttpStatusCode.OK;

            mockWift.Setup(x => x.CreateSession(
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <WiftSessionOptions>(),
                               out statusOK
                               ))
            .Returns(new WiftSession(new Wift("http://a.b.c.d"), "username", "password", "sessionId", "1001"));

            var sut = new WiftConnector(
                mockWift.Object,
                mockConfig.Object
                );

            var ssResult = sut.StartSession();

            Assert.AreEqual(ssResult, true);
        }
        public void WiftConnector_CloseSession_Removes_Wift_Session()
        {
            var mockConfig = new Mock <IConfigurationRoot>();

            mockConfig.SetupGet(x => x[It.IsAny <string>()]).Returns("testvalue");

            var mockWift = new Mock <IWift>();

            mockWift.Setup(x => x.RemoveSessions(
                               It.IsAny <string>(),
                               It.IsAny <string>(),
                               It.IsAny <string>()
                               ));

            var sut = new WiftConnector(
                mockWift.Object,
                mockConfig.Object
                );

            sut.CloseSession();

            mockWift.Verify(x => x.RemoveSessions(
                                It.IsAny <string>(),
                                It.IsAny <string>(),
                                It.IsAny <string>()
                                ), Times.Once);
        }
        public void WiftConnector_is_created()
        {
            var mockConfig = new Mock <IConfigurationRoot>();
            var mockWift   = new Mock <IWift>();

            var sut = new WiftConnector(
                mockWift.Object,
                mockConfig.Object
                );

            Assert.IsInstanceOf <WiftConnector>(sut);
        }
        public void WiftConnector_GetSession_Returns_Wift_Session()
        {
            var mockConfig = new Mock <IConfigurationRoot>();

            mockConfig.SetupGet(x => x[It.IsAny <string>()]).Returns("testvalue");

            var mockWift = new Mock <IWift>();

            var sut = new WiftConnector(
                mockWift.Object,
                mockConfig.Object
                );

            var session = sut.GetSession();

            Assert.AreEqual(session, default(WiftSession));
        }