コード例 #1
0
        // Test DELETE for budget
        public void BudgetsController_Delete_ReturnsNoContentResult_WhenDeleted()
        {
            //Arrange
            int Id = 1;

            //Act
            var result           = controller.Delete(Id);
            var getDeletedResult = controller.Get(Id);

            //Assert
            Assert.IsType <NoContentResult>(result);
            Assert.IsType <NotFoundResult>(getDeletedResult);
        }
コード例 #2
0
        public async Task DeleteValidInputTest()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>();

            optionsBuilder.UseInMemoryDatabase(databaseName: "db1");
            var _dbContext = new ApplicationDbContext(optionsBuilder.Options);

            var controller = new BudgetsController(_dbContext);
            var result     = await controller.Delete(1);

            Assert.NotNull(result);
        }