public void CreateCardAccountSuccessfully() { var content = File.ReadAllText("../../Fixtures/card_account_create.json"); var client = GetMockClient(content); var repo = new CardAccountRepository(client.Object); const string userId = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before var account = new CardAccount { UserId = userId, Active = true, Card = new Card { FullName = "Batman", ExpiryMonth = "11", ExpiryYear = "2020", Number = "4111111111111111", Type = "visa", CVV = "123" } }; var createdAccount = repo.CreateCardAccount(account); client.VerifyAll(); Assert.IsNotNull(createdAccount); Assert.IsNotNull(createdAccount.Id); Assert.AreEqual("AUD", createdAccount.Currency); // It seems that currency is determined by country Assert.IsNotNull(createdAccount.CreatedAt); Assert.IsNotNull(createdAccount.UpdatedAt); }
public void DeleteCardAccountSuccessfully() { var repo = new CardAccountRepository(); var userId = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before var account = new CardAccount { UserId = userId, Active = true, Card = new Card { FullName = "Batman", ExpiryMonth = "11", ExpiryYear = "2020", Number = "4111111111111111", Type = "visa", CVV = "123" } }; var createdAccount = repo.CreateCardAccount(account); Assert.IsTrue(createdAccount.Active); var result = repo.DeleteCardAccount(createdAccount.Id); Assert.IsTrue(result); var gotAccount = repo.GetCardAccountById(createdAccount.Id); Assert.IsFalse(gotAccount.Active); }
public void CreateCardAccountSuccessfully() { var repo = new CardAccountRepository(); var userId = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before var account = new CardAccount { UserId = userId, Active = true, Card = new Card { FullName = "Batman", ExpiryMonth = "11", ExpiryYear = "2020", Number = "4111111111111111", Type = "visa", CVV = "123" } }; var createdAccount = repo.CreateCardAccount(account); Assert.IsNotNull(createdAccount); Assert.IsNotNull(createdAccount.Id); Assert.AreEqual("AUD", createdAccount.Currency); // It seems that currency is determined by country Assert.IsNotNull(createdAccount.CreatedAt); Assert.IsNotNull(createdAccount.UpdatedAt); }
public void DeleteCardAccountSuccessfully() { var content = File.ReadAllText("../../Fixtures/card_account_delete.json"); var client = GetMockClient(content); var repo = new CardAccountRepository(client.Object); const string id = "25d34744-8ef0-46a4-8b18-2a8322933cd1"; var result = repo.DeleteCardAccount(id); client.VerifyAll(); Assert.IsTrue(result); }
public void GetUserForCardAccountSuccessfully() { var content = File.ReadAllText("../../Fixtures/card_account_get_users.json"); var client = GetMockClient(content); var repo = new CardAccountRepository(client.Object); var gotUser = repo.GetUserForCardAccount("25d34744-8ef0-46a4-8b18-2a8322933cd1"); client.VerifyAll(); Assert.IsNotNull(gotUser); Assert.AreEqual("1", gotUser.Id); }
public void GetCardAccountEmptyId() { var client = GetMockClient(""); var repo = new CardAccountRepository(client.Object); repo.GetCardAccountById(string.Empty); }
public void GetCardAccountEmptyId() { var repo = new CardAccountRepository(); repo.GetCardAccountById(string.Empty); }
public void GetUserForCardAccountSuccessfully() { var repo = new CardAccountRepository(); var userId = "ec9bf096-c505-4bef-87f6-18822b9dbf2c"; //some user created before var account = new CardAccount { UserId = userId, Active = true, Card = new Card { FullName = "Batman", ExpiryMonth = "11", ExpiryYear = "2020", Number = "4111111111111111", Type = "visa", CVV = "123" } }; var createdAccount = repo.CreateCardAccount(account); var gotUser = repo.GetUserForCardAccount(createdAccount.Id); Assert.IsNotNull(gotUser); Assert.AreEqual(userId, gotUser.Id); }