public JsonResult GetSchool() { SchoolController obj = new SchoolController(); List <School> objSchool = obj.GetSchool(); return(Json(objSchool, JsonRequestBehavior.AllowGet)); }
public void TestGetByIdSchool() { var repository = Mock.Create <IRepository <School> >(); var school = new School() { Id = 1, Name = "PMG", Location = "Sofia" }; Mock.Arrange <School>( () => repository.Get(school.Id)) .IgnoreArguments() .Returns(school) .MustBeCalled(); var controller = new SchoolController(repository); SetupController.Create(controller, "get", "school"); var result = controller.GetSchool(school.Id); Assert.AreEqual(result.Id, school.Id); Assert.AreEqual(result.Name, school.Name); Assert.AreEqual(result.Location, school.Location); }
public void GetSchool_Test() { var Respond = _schoolController.GetSchool(2); var Result = Respond as OkObjectResult; Assert.AreEqual(200, Result.StatusCode); }