public async void RemoveOperation_FromInitializedDbTable_RemovedOperationNotFoundInDb() { // arrange var operation = GetOperation(); fixture.db.Add(operation); await fixture.db.SaveChangesAsync(); // act await logic.RemoveDataModelAsync(operation); // assert var actual = await fixture.db.Operation.FirstOrDefaultAsync(i => i.Id == operation.Id); Assert.Null(actual); }
public async Task <IActionResult> DeleteSingleItem(Operation model) { var statusMessage = await logicValidation.CheckRemoveDataModelAsync(model.Id); if (statusMessage.IsCompleted) { await logic.RemoveDataModelAsync(model); await logProvider.AddToLogAsync($"Removed operation (Id: {model.Id})."); return(RedirectToRoute(TransactionsRouting.SingleItem, new { key = model.TransactionId })); } else { return(View("CustomError", statusMessage)); } }