public void AddBuildingReturnsBadRequest() { //Arrange Building building = null; var controller = new PlantConfigurationController(); // Act var actionResult = controller.AddBuilding(building); //Assert Assert.IsInstanceOfType(actionResult, typeof(BadRequestErrorMessageResult)); }
public void AddBuildingReturnsCreated() { //Arrange var building = TestData.getBuilding(); var item = new PlantInfo().RetrieveAsset().LastOrDefault(); var i = item.ID; var controller = new PlantConfigurationController(); //Act var actionResult = controller.AddBuilding(building); var createdresult = actionResult as CreatedNegotiatedContentResult <string>; //Assert Assert.IsNotNull(createdresult); Assert.AreEqual("api/PlantConfiguration/Building", createdresult.Location.OriginalString); Assert.AreEqual((i + 1).ToString(), createdresult.Content); }