Пример #1
0
        public async Task On_successful_login_set_login_token()
        {
            var loginOption = Substitute.For <ILoginOption>();
            var loginResult = AutoFixture.Build <MethodResult <LoginResult> >()
                              .With(x => x.Error, null)
                              .Create();

            _driverMock.LoginAsync(loginOption).Returns(Task.FromResult(loginResult));

            var bot = new RocketChatBot(_driverMock, _loggerMock);

            // Act
            await bot.LoginAsync(loginOption);

            // Assert
            bot.LoginToken.Should().Be(loginResult.Result.Token);
        }
        public void When_login_option_is_unknown_throw()
        {
            var options = AutoFixture.Create <DummyLoginOption>();

            // Act
            Action action = () => _driver.LoginAsync(options).Wait();

            //
            action.ShouldThrow <NotSupportedException>();
        }