public async Task Delete_NullReferenceException()
        {
            // Arrange
            _regionAnnualReportService.Setup(x => x.DeleteAsync(It.IsAny <int>()));
            // Act
            var result = await _regionController.Delete(1);

            // Assert
            Assert.IsInstanceOf <ObjectResult>(result);
            Assert.IsTrue((result as ObjectResult).StatusCode == 404);
        }
Esempio n. 2
0
        public async Task RegionsDeleteReturnsView()
        {
            //Arrange
            Region regionTest = new Region()
            {
                RegionID = 60, RegionDescription = "Acasa"
            };
            await _regionsControllerTest.Create(regionTest);

            //Act
            var result = _regionsControllerTest.Delete(regionTest.RegionID);

            //Assert
            Assert.IsNotNull(result);

            var region = db.Regions.Where(r => r.RegionDescription == regionTest.RegionDescription);

            db.Regions.RemoveRange(region);
            db.SaveChanges();
        }