public async Task Destination_ReturnsCorrectResult() { var centerNumber = 22; var routeId = 132084; var routeNumber = "639T"; var deliveryDate = DateTime.Today; _routeServiceMock = new Mock <IRouteService>(); _routeServiceMock.Setup(r => r.GetByRouteIdAsync(It.IsAny <int>())).Returns(Task.FromResult(_searchableRoutes.First(r => r.RouteId == routeId))); _routeServiceMock.Setup(r => r.GetByRouteIdAndCenterNumberAndRouteNumberAsync(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>())).Returns(Task.FromResult(_searchableRoutes.First(r => r.RouteId == routeId))); _routeService = _routeServiceMock.Object; RouteManagerController controller = new RouteManagerController(_routeService, null, null, null) { ControllerContext = new ControllerContext() { HttpContext = _contextMock.Object } }; var result = await controller.Destination(routeId, centerNumber, routeNumber, deliveryDate) as JsonResult; var model = JsonConvert.DeserializeObject <dynamic>(result.Data.ToString()); Assert.IsNotNull(model); Assert.AreEqual(routeId.ToString(), ((Newtonsoft.Json.Linq.JValue)Newtonsoft.Json.Linq.JObject.Parse(result.Data.ToString())["RouteId"]).Value.ToString()); }