public async Task GetWebsiteTypesReturnsValidResponse() { using (var context = SqlLiteInMemory.GetTestContext()) { context.SeedDbWebsiteTypes(); var lookupController = new LookupController(context); var result = await lookupController.GetWebsiteTypes(); Assert.That(result, Is.InstanceOf(typeof(OkObjectResult))); var ok = (OkObjectResult)result; Assert.That(ok.Value, Is.InstanceOf(typeof(List <WebsiteType>))); var listResult = (List <WebsiteType>)ok.Value; Assert.AreEqual(4, listResult.Count); } }
public async Task GetContactReturnsValidResponse() { using (var context = SqlLiteInMemory.GetTestContext()) { var userId = context.SeedDbContacts(); var contactRepository = new ContactRepository(context); var contactController = new ContactsController(contactRepository); var result = await contactController.GetContacts(userId); Assert.That(result, Is.InstanceOf(typeof(OkObjectResult))); var ok = (OkObjectResult)result; Assert.That(ok.Value, Is.InstanceOf(typeof(List <Contact>))); var listResult = (List <Contact>)ok.Value; Assert.AreEqual(2, listResult.Count); } }