public ActionResult Watch(Watch watch) { if (ModelState.IsValid) { watch.Response = _elasticSearchService.AddWatch(watch); watch.Flight = _elasticSearchService.GetFlightById(watch.FlightId); watch.Name = string.Empty; watch.Email = string.Empty; return View(watch); } return View(watch); }
public void Adds_A_Watch() { var controller = new WatchController(new MockElasticSearchService()); var requestModel = new Watch { Email = "*****@*****.**", Name = "richard teasdale" }; var response = (ViewResult)controller.Watch(requestModel); var responseModel = (Watch)response.Model; Assert.That(responseModel.Response.Created, Is.True); }