Exemplo n.º 1
0
        public async Task GetContactById_ContactDoesNotExist()
        {
            var dbContext = DbContextMocker.GetPhoneBookDbContext(nameof(GetContactById_ContactDoesNotExist));
            PhoneBookRepository repository = new PhoneBookRepository(dbContext);

            Contact contact = await repository.GetContact(1000);

            dbContext.Dispose();

            Assert.Null(contact);
        }
Exemplo n.º 2
0
        public async Task GetContactById_ContactExists()
        {
            var dbContext = DbContextMocker.GetPhoneBookDbContext(nameof(GetContactById_ContactExists));
            PhoneBookRepository repository = new PhoneBookRepository(dbContext);

            Contact contact = await repository.GetContact(1);

            dbContext.Dispose();

            Assert.NotNull(contact);
            Assert.NotEmpty(contact.ContactPhones);
        }