예제 #1
0
        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);
        }
예제 #2
0
        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));
            }
        }