public void DepartmentController_Details_ID_Not_Found()
        {
            //arrange
            var repositoryMock = new Mock<IDepartmentRepository>();
            Department data = null;

            repositoryMock.Setup(x => x.Find(1)).Returns(data);
            DepartmentController objController = new DepartmentController(repositoryMock.Object);

            //act
            var result = objController.Details(1);

            //assert
            repositoryMock.Verify(x => x.Find(1), Times.Once());
            Assert.IsInstanceOfType(result, typeof(System.Web.Mvc.HttpNotFoundResult));
            Assert.IsNotInstanceOfType(result, typeof(ViewResult));
        }
        public void DepartmentController_Details_Successfull()
        {
            //arrange
            var repositoryMock = new Mock<IDepartmentRepository>();
            var data = new Department { Address = "131 West Ave", City = "Boston", DepartmentId = 1, Description = "Description of Department", IsActive = true, IsDeleted = false, Name = "Media Department", PostalCode = "49655", State = "MA" };

            repositoryMock.Setup(x => x.Find(1)).Returns(data);
            DepartmentController objController = new DepartmentController(repositoryMock.Object);

            //act
            var result = objController.Details(1);
            ViewResult _viewresult = (ViewResult)result;

            //assert
            repositoryMock.Verify(x => x.Find(1), Times.Once());
            Assert.IsInstanceOfType(((ViewResult)result).Model, typeof(Department));
            Assert.AreEqual(_viewresult.Model, data);
        }
        public void DepartmentController_Details_ID_LessThanOne()
        {
            //arrange
            var repositoryMock = new Mock<IDepartmentRepository>();
            var data = new Department { Address = "131 West Ave", City = "Boston", DepartmentId = 1, Description = "Description of Department", IsActive = true, IsDeleted = false, Name = "Media Department", PostalCode = "49655", State = "MA" };

            repositoryMock.Setup(x => x.Find(0)).Returns(data);
            DepartmentController objController = new DepartmentController(repositoryMock.Object);

            //act
            var result = objController.Details(0);

            //assert
            repositoryMock.Verify(x => x.Find(0), Times.Never());
            Assert.AreEqual(((ViewResult)result).ViewData["Message"], "Missing id value");
        }