示例#1
0
        public async Task delete_model_throw_not_found()
        {
            var db         = BaseDbContextMock.GetDbContext();
            var controller = new BaseControllerMock(db);

            var actionResult = await controller.DeleteItemAsync(8);

            Assert.IsType <NotFoundResult>(actionResult);
        }
示例#2
0
        public async Task delete_model()
        {
            var db         = BaseDbContextMock.GetDbContext();
            var controller = new BaseControllerMock(db);

            var actionResult = await controller.DeleteItemAsync(6);

            var ent = await db.Models.Where(x => x.Id == 6).FirstAsync();

            Assert.IsType <OkResult>(actionResult);
            Assert.NotNull(ent.DeletedAt);
        }