public async Task DeleteGetActionWithId2_ReturnsModelFromService() { // Arrange // Act var result = await validController.Delete(entity.Id) as ViewResult; // Assert Assert.Equal(entity, result.Model); }
public void Delete_Normally_ShouldWork() { Currency createdCurrency, queriedCurrency; IEnumerable <Currency> listedCurrencies; using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CurrenciesController(dataLayer)) { createdCurrency = controller.CreateCurrency(TestDataProvider.CreateNewCurrency()); queriedCurrency = controller.Get(createdCurrency.Id); controller.Delete(createdCurrency.Id); listedCurrencies = controller.List(); } Assert.AreEqual(createdCurrency.Id, queriedCurrency.Id, "Unexpected ID."); Assert.AreEqual(false, listedCurrencies.Any(), "There should be no partners returned."); }
public void Delete_WhenRecordDoesNotExist_ShouldThrow() { using (var dataLayer = DataLayerHelper.CreateDataLayer()) using (var controller = new CurrenciesController(dataLayer)) controller.Delete(1); }