Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void TestEditWithNull()
        {
            var result = controller.Edit(0);

            result.Should().NotBe(null);
        }