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"); }); }
private static async Task <RawTransaction> LoadByTagAndId(BuxferClient target, int id, string tag) { var loadedTransactions = await target.GetRawTransactions(f => f.TagName = tag); var loadedTransaction = loadedTransactions.Entities.Should() .Contain(t => t.Id == id).Subject; return(loadedTransaction); }
private static async Task <T> Load <T>(BuxferClient target, int id, string tag) { var loadedTransactions = await target.GetTransactions(f => f.TagName = tag); var loadedTransaction = loadedTransactions.Entities.Should() .Contain(t => t.Id == id).Subject; return(loadedTransaction.Should().BeOfType <T>().Subject); }
public void Authenticator_InvalidCredentials_Exception() { var logger = LoggerFactory.Create(c => c.AddConsole()).CreateLogger <AuthTest>(); var target = new BuxferClient("*****@*****.**", "bk", logger); Assert.ThrowsAsync(Is.TypeOf <BuxferException>() .And.Message.Contain("Email or username does not match an existing account."), async() => { await target.GetTransactions(); }); }
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); }