public void EditTest() { var controller = new BuildingsController(); var result = controller.Index() as ViewResult; var buildings = (ICollection <Building>)result.ViewData.Model; var editBuilding = buildings.Last(); editBuilding.Name = "NewBuildingName"; editBuilding.Address = "NewBuildingAddress"; controller.Edit(editBuilding); var result2 = controller.Index() as ViewResult; var buildings2 = (ICollection <Building>)result2.ViewData.Model; Assert.AreEqual("NewBuildingName", buildings2.Last().Name); }
public void TestEditWithNull() { var result = controller.Edit(0); result.Should().NotBe(null); }