public void TestIndex() { ContactsController controller = new ContactsController(_repository); JsonResult result = controller.Index() as JsonResult; List<Contact> contacts = result.Data as List<Contact>; Assert.AreEqual(3, contacts.Count()); }
public void TestDeleteIndex() { const int contactId = 1; ContactsController controller = new ContactsController(_repository); JsonResult result = controller.Delete(contactId) as JsonResult; result = controller.Index() as JsonResult; List<Contact> contacts = result.Data as List<Contact>; Assert.AreEqual(2, contacts.Count()); }