public void Get() { controller = new GeocacheApiController(); var response = controller.Get(); var contentResult = response as OkNegotiatedContentResult <List <Geocache> >; Assert.IsInstanceOfType(response, typeof(OkResult)); Assert.IsNotNull(response); Assert.IsNotNull(contentResult.Content); }
public void GetGeocacheById() { controller = new GeocacheApiController(); var response = controller.Get(2); var contentResult = response as OkNegotiatedContentResult <Geocache>; Geocache geocache = contentResult.Content; Assert.IsNotNull(response); Assert.IsInstanceOfType(response, typeof(OkNegotiatedContentResult <Geocache>)); Assert.IsNotNull(contentResult); Assert.AreEqual("BarCache", geocache.Name); Assert.AreEqual(47.256219M, geocache.Latitude); Assert.AreEqual(-122.439684M, geocache.Longitude); }
public void GetAllGeocaches() { controller = new GeocacheApiController(); var response = controller.Get(); var contentResult = response as OkNegotiatedContentResult <List <Geocache> >; List <Geocache> list = contentResult.Content; int count = list.Count; Geocache cache = list[0]; Assert.IsNotNull(response); Assert.IsInstanceOfType(response, typeof(OkResult)); Assert.AreEqual(12, count); Assert.IsNotNull(response); Assert.AreEqual("RustonWay", cache.Name); }