Пример #1
0
        public void LoginCallsApiConnectionLoginMethodAndIfItsSessionIsNotNullLoggedInIsSetToTrue()
        {
            // Arrange
            CiApi.Instance.SetUpApiForMocking(_mockApiConnection, _mockStreamingManager);
            SetUpApiInstanceToBeLoggedOut();

            var response = new ApiLogOnResponseDTO()
            {
                Session = "validSession"
            };

            _mockApiConnection.Expect(x => x.Login(USERNAME, PASSWORD, TRADING_URL)).Return(response);

            // Act
            var result = CiApi.Instance.Login(USERNAME, PASSWORD, TRADING_URL);

            // Assert
            Assert.IsTrue(CiApi.Instance.LoggedIn);
            Assert.AreEqual(response, result);
            _mockApiConnection.VerifyAllExpectations();
        }