Пример #1
0
        public void SelectById_WhenPassedId_ShouldReturnAccount()
        {
            //arrange
            SqlAccountRepository accountRepository = new SqlAccountRepository(connectionString);

            //act
            Account account = accountRepository.SelectById("acc1");

            //assert
            Assert.Equal("John Smith", account.Name);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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"));
        }