public void SelectById_WhenPassedId_ShouldReturnAccount() { //arrange SqlAccountRepository accountRepository = new SqlAccountRepository(connectionString); //act Account account = accountRepository.SelectById("acc1"); //assert Assert.Equal("John Smith", account.Name); }
public void Update_Account_ShouldUpdateAccount() { //arrange SqlAccountRepository accountRepository = new SqlAccountRepository(connectionString); Account account = new Account("acc1", "Jim Smith"); //act bool updated = accountRepository.Update(account); //assert Assert.True(updated); Assert.Equal("Jim Smith", accountRepository.SelectById("acc1").Name); }
public void Delete_WhenPassedId_ShouldRemoveAccount() { //arrange SqlAccountRepository accountRepository = new SqlAccountRepository(connectionString); //act bool deleted = accountRepository.Delete("acc1"); //assert Assert.True(deleted); Assert.Null(accountRepository.SelectById("acc1")); }
public void Create_DuplicateAccount_ShouldReturnFalse() { //arrange SqlAccountRepository accountRepository = new SqlAccountRepository(connectionString); Account account = new Account("acc2", "Jane Jones"); //act bool firstAccountCreated = accountRepository.Create(account); bool secondAccountCreated = accountRepository.Create(account); //assert Assert.True(firstAccountCreated); Assert.False(secondAccountCreated); }