public void Create_Point_Test_Longtitude_Latitude_Limits() { //testing valid values for longitude and latitude newPoint = tu.CreatePointObject(-180, -90); var result = ps.CreatePoint(newPoint); Assert.IsNotNull(result); newPoint = tu.CreatePointObject(180, 90); result = ps.CreatePoint(newPoint); Assert.IsNotNull(result); //testing invalid values for longitude and latitude newPoint = tu.CreatePointObject(-181, -90); Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint)); newPoint = tu.CreatePointObject(-180, -91); Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint)); newPoint = tu.CreatePointObject(181, 90); Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint)); newPoint = tu.CreatePointObject(180, 91); Assert.ThrowsException <InvalidPointException>(() => ps.CreatePoint(newPoint)); }
public void ReadPoint_200() { newUser = _tu.CreateUserObject(); Session newSession = _tu.CreateSessionObject(newUser); _tu.CreateSessionInDb(newSession); var point = _tu.CreatePointObject(179, 81); point = _tu.CreatePointInDb(point); var endpoint = API_ROUTE_LOCAL + "/api/point/" + point.Id; controller.Request = new HttpRequestMessage { RequestUri = new Uri(endpoint) }; var request = new HttpRequestMessage(); request.Headers.Add("token", newSession.Token); controller.Request = request; OkNegotiatedContentResult <Point> response = (OkNegotiatedContentResult <Point>)controller.Get(point.Id.ToString()); Assert.AreEqual(point.Name, response.Content.Name); Assert.AreEqual(point.Description, response.Content.Description); Assert.AreEqual(point.Longitude, response.Content.Longitude); Assert.AreEqual(point.Latitude, response.Content.Latitude); }