Exemplo n.º 1
0
        public void Get_Ok()
        {
            ContactsRepository contactsRepository = new ContactsRepository(mockContext.Object);
            var result = contactsRepository.GetContact(1);

            Assert.IsNotNull(result);
        }
Exemplo n.º 2
0
        public async Task AddingNewPersonWorks()
        {
            ContactsRepository cr = new ContactsRepository();

            var contact = new Contact("Test", "Contact");

            var id = await cr.CreateContact(contact);

            var returnedContact = await cr.GetContact(id);

            Assert.NotNull(returnedContact);
            Assert.Equal(contact.FirstName, returnedContact.FirstName);
            Assert.Equal(contact.LastName, returnedContact.LastName);
        }
Exemplo n.º 3
0
 public ActionResult <Contact> ActionWithInferredFromServicesParameter(int id, ContactsRepository repository)
 => repository.GetContact(id) ?? new Contact()
 {
     ContactId = id
 };