public void DeleteHoliday()
        {
            // Arrange
            HolidayController controller = new HolidayController();

            var actResult = controller.Delete(1);
            // Act
            var result = actResult as OkNegotiatedContentResult <bool>;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Content == true);
        }
Esempio n. 2
0
        public void DeleteGet_InvalidHoliday()
        {
            // Arrange - create the controller
            HolidayController target = new HolidayController(mock.Object);

            // Act - call the action method
            var     result  = (HttpNotFoundResult)target.Delete(150);
            Holiday Holiday = mock.Object.Holidays.Where(m => m.HolidayID == 1500).FirstOrDefault();

            // Assert - check the result
            Assert.IsInstanceOf(typeof(HttpNotFoundResult), result);
            Assert.IsNull(Holiday);
            Assert.AreEqual(404, result.StatusCode);
        }
Esempio n. 3
0
        public void DeleteGet_ValidCountryWithoutAssociatedDate_CannotDelete()
        {
            // Arrange - create the controller
            HolidayController target = new HolidayController(mock.Object);

            // Act - call the action method
            var result = target.Delete(3) as ViewResult;

            // Assert - check the result
            Assert.AreEqual("", result.ViewName);
            Assert.IsInstanceOf(typeof(Holiday), result.ViewData.Model);
            Assert.IsInstanceOf(typeof(ViewResult), result);
            Assert.IsNotNull(result.ViewData.Model);
        }