public IQueryable<PlanetarySystem> GetPlanetarySystems(Galaxy theGalaxy) { if (theGalaxy != null) return new List<PlanetarySystem>().AsQueryable(); else throw new PomonaServerException("A test called GetPlanetarySystems in HandlerMethodTests.cs without a Galaxy."); }
public void CreateTestData() { var galaxy = new Galaxy() { Name = "milkyway" }; var planetarySystem = new PlanetarySystem() { Name = "solar", Galaxy = galaxy }; galaxy.PlanetarySystems.Add(planetarySystem); var planet = new Planet() { Name = "earth", PlanetarySystem = planetarySystem }; planetarySystem.Planets.Add(planet); Save(galaxy); }
public void GetUriFor_WithEntityWithSpaceInPath_EncodesUrlTheRightWay() { var typeMapper = new TypeMapper(new CritterPomonaConfiguration()); var uriResolver = new UriResolver(typeMapper, new DummyBaseUriProvider() { BaseUri = new Uri("http://whateva/") }); var galaxy = new Galaxy() { Name = "this is it" }; var url = uriResolver.GetUriFor(galaxy); Assert.That(url, Is.EqualTo("http://whateva/galaxies/this%20is%20it")); }
public void GetUriFor_entity_having_reserved_characters_in_path_segment_encodes_url_correctly() { var galaxy = new Galaxy() { Name = "this is it!?~_--- :;" }; var url = this.uriResolver.GetUriFor(galaxy); Assert.That(url, Is.EqualTo("http://whateva/galaxies/this%20is%20it%21%3F%7E_---%20%3A%3B")); }