コード例 #1
0
        public void RetriveRegionsDataTest()
        {
            List<Region> expectedList=new List<Region>();
            Region reg = new Region()
            {
                City="Kirovohrad",
                Population=200,
                Production="Oil"

            };
            expectedList.Add(reg);
            var mockCsvContext = new Mock<ICsvContext>();
            mockCsvContext
                .Setup(x => x.Read<Region>(It.IsAny<string>()))
                .Returns(expectedList);

            var httpRuntimeWrapper = new Mock<HttpRuntimeWrapper>();
            httpRuntimeWrapper.SetupGet(x => x.AppDomainAppVirtualPath).Returns(pathActual);
            DataPathHelper dataPathHelper = new DataPathHelper(httpRuntimeWrapper.Object);
            HomeController homeCntrl = new HomeController(mockCsvContext.Object);
            JsonResult result = homeCntrl.RetriveRegionsData() as JsonResult;
            List<Region> actualList = result.Data as List<Region>;

            CollectionAssert.AreEqual(actualList, expectedList);
        }
コード例 #2
0
 public ActionResult SaveRegionData(Region region)
 {
     regionCrud.Add(region);
     return Json(null,JsonRequestBehavior.DenyGet);
 }
コード例 #3
0
        public ActionResult EditRegionData(Region region)
        {
            regionCrud.Update(region);

            return Json(null, JsonRequestBehavior.DenyGet);
        }