public void AddDepartmentReturnsBadRequest()
        {
            //Arrange
            Department department          = null;
            var        duplicateDepartment = new Department {
                DepartmentName = "Bakery1", PlantId = 5, CreatedBy = "Admin", ModifiedBy = "Admin"
            };
            var controller = new PlantConfigurationController();

            // Act

            var actionResult  = controller.AddDepartment(department);
            var actionResult1 = controller.AddDepartment(duplicateDepartment);

            //Assert
            Assert.IsInstanceOfType(actionResult, typeof(BadRequestErrorMessageResult));
            Assert.IsInstanceOfType(actionResult1, typeof(BadRequestErrorMessageResult));
        }
        public void AddDepartmentReturnsCreated()
        {
            // Arrange

            var department = TestData.getDepartment();
            var item       = new PlantInfo().RetrieveAsset().LastOrDefault();
            var i          = item.ID;
            var controller = new PlantConfigurationController();

            //Act

            var actionResult  = controller.AddDepartment(department);
            var createdresult = actionResult as CreatedNegotiatedContentResult <string>;

            //Assert
            Assert.IsNotNull(createdresult);
            Assert.AreEqual("api/PlantConfiguration/department", createdresult.Location.OriginalString);
            Assert.AreEqual((i + 1).ToString(), createdresult.Content);
        }