public async void RemoveLicense_FromInitializedDbTable_RemovedLicenseNotFoundInDb() { // arrange var license = GetLicense(); fixture.db.Add(license); await fixture.db.SaveChangesAsync(); // act await logic.RemoveDataModelAsync(license.Id); // assert var actual = await fixture.db.License.FirstOrDefaultAsync(i => i.Id == license.Id); Assert.Null(actual); }
public async Task <IActionResult> DeleteSingleItem(string key) { int id = Int32.Parse(key); var statusMessage = await logicValidation.CheckRemoveDataModelAsync(id); if (statusMessage.IsCompleted) { await logic.RemoveDataModelAsync(id); await logProvider.AddToLogAsync($"Removed license (Id: {key})."); return(RedirectToRoute(LicensesRouting.Index)); } else { return(View("CustomError", statusMessage)); } }