Пример #1
0
        public void Login_ValidCredentials_Authenticated()
        {
            var target = new BuxferClient ();
            target.Login ("*****@*****.**", "");

            Assert.IsTrue (target.Authenticated);
        }
Пример #2
0
        public void Login_InvalidCredentials_Exception()
        {
            var target = new BuxferClient ();

            ExceptionAssert.IsThrowing (new BuxferException ("Email or username does not match an existing account."), () => {
                target.Login ("*****@*****.**", "dohdoh");
            });
        }
Пример #3
0
        public void Login_InvalidCredentials_Exception()
        {
            var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>();
            var target = new BuxferClient("*****@*****.**", "dohdoh", logger);

            Assert.ThrowsAsync(Is.TypeOf <BuxferException>()
                               .And.Message.Contain("Email or username does not match an existing account."),
                               async() => await target.Login()
                               );
        }
Пример #4
0
        public async Task Login_ValidCredentials_Authenticated_And_returns_Token()
        {
            var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>();

            var target = new BuxferClient("*****@*****.**", SecretManager.LoadSettings().Password, logger);
            var token  = await target.Login();

            Console.WriteLine($"token is {token}");
            Assert.NotNull(token);
            Assert.IsTrue(target.Authenticated);
        }
Пример #5
0
        public async Task Login_withAPITokenWorks()
        {
            var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>();

            var apiToken = SecretManager.LoadSettings().APIToken;
            var target   = new BuxferClient(apiToken, logger);
            var token    = await target.Login();

            token.Should().Be(apiToken);

            Assert.IsTrue(target.Authenticated);
        }