Beispiel #1
0
        public async Task FindContactInContext_ContactDoesNotExist()
        {
            var dbContext = DbContextMocker.GetPhoneBookDbContext(nameof(FindContactInContext_ContactDoesNotExist));
            PhoneBookRepository repository = new PhoneBookRepository(dbContext);

            int     id      = 2000;
            Contact contact = await repository.FindAsync(id);

            dbContext.Dispose();

            Assert.Null(contact);
        }
Beispiel #2
0
        public async Task FindContactInContext_ContactExists()
        {
            var dbContext = DbContextMocker.GetPhoneBookDbContext(nameof(FindContactInContext_ContactExists));
            PhoneBookRepository repository = new PhoneBookRepository(dbContext);

            int     id      = 2;
            Contact contact = await repository.FindAsync(id);

            dbContext.Dispose();

            Assert.NotNull(contact);
            Assert.Equal(id, contact.ContactId);
            Assert.NotNull(contact.ContactPhones);
            Assert.NotEmpty(contact.ContactPhones);
        }