Exemplo n.º 1
0
        public async void RemoveTechProcess_FromInitializedDbTable_RemovedTechProcessNotFoundInDb()
        {
            // arrange
            var techProcess = GetTechProcess();

            fixture.db.Add(techProcess);
            await fixture.db.SaveChangesAsync();

            // act
            await logic.RemoveDataModelAsync(techProcess);

            // assert
            var actual = await fixture.db.TechProcess.FirstOrDefaultAsync(i => i.FacilityId == techProcess.FacilityId && i.RecipeId == techProcess.RecipeId);

            Assert.Null(actual);
        }
        public async Task <IActionResult> DeleteSingleItem(TechProcess model)
        {
            var statusMessage = await logicValidation.CheckRemoveDataModelAsync((model.FacilityId, model.RecipeId));

            if (statusMessage.IsCompleted)
            {
                await logic.RemoveDataModelAsync(model);

                await logProvider.AddToLogAsync($"Removed technological process (Facility Id: {model.FacilityId}; Recipe Id: {model.RecipeId}).");

                return(RedirectToRoute(FacilityTechProcessesRouting.Index, new { key = model.FacilityId }));
            }
            else
            {
                return(View("CustomError", statusMessage));
            }
        }