public void List_ShouldReturn_CreatedPartners() { Partner createdPartner1, createdPartner2; IEnumerable <Partner> queriedPartners; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new PartnersController(dataLayer)) { createdPartner1 = controller.CreatePartner(TestDataProvider.CreateNewPartner()); createdPartner2 = controller.CreatePartner(TestDataProvider.CreateAnotherNewPartner()); queriedPartners = controller.List(); } AssertPartnersInList(queriedPartners, createdPartner1, createdPartner2); }
public void Delete_Normally_ShouldWork() { Partner createdPartner, queriedPartner; IEnumerable <Partner> listedPartners; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new PartnersController(dataLayer)) { createdPartner = controller.CreatePartner(TestDataProvider.CreateNewPartner()); queriedPartner = controller.Get(createdPartner.Id); controller.Delete(createdPartner.Id); listedPartners = controller.List(); } Assert.AreEqual(createdPartner.Id, queriedPartner.Id, "Unexpected ID."); Assert.AreEqual(false, listedPartners.Any(), "There should be no partners returned."); }