public void Get_Ok() { ContactsRepository contactsRepository = new ContactsRepository(mockContext.Object); var result = contactsRepository.GetContact(1); Assert.IsNotNull(result); }
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); }
public ActionResult <Contact> ActionWithInferredFromServicesParameter(int id, ContactsRepository repository) => repository.GetContact(id) ?? new Contact() { ContactId = id };