Beispiel #1
0
        public void Filter_ValidPredicate_ReturnsCorrectAccounts()
        {
            //arrange
            var context = DbContextUtils.GetInMemoryContext();

            context.SeedAccounts();
            var accountRepository = new AccountRepository(context);

            //act
            var accounts = accountRepository.Filter(x => x.Currency == "USD");

            //assert
            Assert.Contains(accounts, a => a.Currency == "USD");
        }
Beispiel #2
0
        public void GetById_ExistingId_ReturnsCorrectAccount(long id, bool expectedResult)
        {
            //arrange
            var context = DbContextUtils.GetInMemoryContext();

            context.SeedAccounts();
            var accountRepository = new AccountRepository(context);

            //act
            var account = accountRepository.GetById(id);

            if (expectedResult)
            {
                Assert.NotNull(account);
                Assert.Equal(id, account.Id);
            }
            else
            {
                Assert.Null(account);
            }
        }