public void Login_ValidCredentials_Authenticated() { var target = new BuxferClient (); target.Login ("*****@*****.**", ""); Assert.IsTrue (target.Authenticated); }
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"); }); }
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() ); }
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); }
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); }