public ActionResult UpdateBuilding(Building building) { if (ModelState.IsValid) { if (_buildingManager.UpdateBuilding(building)) { //Correct TempData["notification"] = building.Name.UpdateMessage("Building"); return(RedirectToAction("Index")); } else { //Error TempData["notification"] = building.Name.ErrorUpdateMessage("Building"); return(View(building)); } } else { //Error TempData["notification"] = building.Name.ErrorUpdateMessage("Building"); return(View(building)); } }
public void TestUpdateBuildingValidInput() { // arrange bool expectedResult = true; bool actualResult; Building oldBuilding = buildings[0]; // Update first building in list Building newBuilding = new Building() { BuildingID = oldBuilding.BuildingID, Name = "New Good Name", Address = "123 New Good Address", Description = "New Good Description", StatusID = "Undergoing Maintanance", ResortPropertyID = 123456, }; // act actualResult = buildingManager.UpdateBuilding(oldBuilding, newBuilding); // assert - check if building was updated Assert.AreEqual(expectedResult, actualResult); }