public void ShouldReturnJsonResult_PageEvent() { // Arrange var pageEventPostModel = new PageEventPostModel(); var pageEvent = new PageEvent(); _entityMapper.Expect(x => x.Map<PageEvent>(pageEventPostModel)).Return(pageEvent); _pageEventTrackingService.Expect(x => x.Add(pageEvent)); _mockRepository.ReplayAll(); // Act var jsonResult = _trackingController.PageEvent(pageEventPostModel); // Assert Assert.That(jsonResult, Is.Not.Null); _mockRepository.VerifyAll(); }
public JsonResult PageEvent(PageEventPostModel pageEventPostModel) { var pageEvent = _entityMapper.Map<PageEvent>(pageEventPostModel); var model = _pageEventTrackingService.Add(pageEvent); return Json(model, JsonRequestBehavior.AllowGet); }