예제 #1
0
        public void TestAccountGetAll()
        {
            // arrange
            IAccountRepository repo = new InMemoryAccountListRepository();

            // act
            var result = repo.GetAll().ToArray();

            // assert
            Assert.AreEqual(1, result[0].Id);
        }
예제 #2
0
        public void TestAccount_Delete()
        {
            // arrange
            IAccountRepository repo = new InMemoryAccountListRepository();

            // act
            var account  = repo.Delete(1);
            var accounts = repo.GetAll();

            // assert
            Assert.AreEqual(1, account.Id);
            Assert.AreEqual(1, accounts.Count());
        }
예제 #3
0
        public void TestAccount_Update()
        {
            // arrange
            IAccountRepository repo = new InMemoryAccountListRepository();

            // act
            var account = repo.GetById(1);

            account.Name = "Dan2";
            account      = repo.Update(account);

            // assert
            Assert.AreEqual(1, account.Id);
            Assert.AreEqual("Dan2", account.Name);
        }
예제 #4
0
        public void TestAccountQueryByName()
        {
            // arrange
            IAccountRepository repo = new InMemoryAccountListRepository();

            // act
            var result = repo.Query(new Data.Models.AccountQueryParameter
            {
                Name = "Steve"
            }).ToArray();

            // assert
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(1, result[0].Id);
        }
예제 #5
0
        public void TestAccount_Add()
        {
            // arrange
            IAccountRepository repo = new InMemoryAccountListRepository();

            var account = new Account()
            {
                Id   = 0,
                Name = "Dan"
            };

            // act
            var result = repo.Add(account);

            // assert
            Assert.AreEqual(3, account.Id);
        }