public void TestItReturnsElementsInOrder() { OutputGroup group1 = new("1"); OutputGroup group2 = new("2"); outputGroups.AddGroupWithFiles(group1, new List <string> { "foo.txt" }); outputGroups.AddGroupWithFiles(group2, new List <string> { "goo.txt" }); Geo first = GeoFactory.Make(definition: DefinitionFactory.Make("foo.txt")); Geo second = GeoFactory.Make(definition: DefinitionFactory.Make("goo.txt")); Geo third = GeoFactory.Make(definition: DefinitionFactory.Make("foo.txt")); RunwayCentreline fourth = RunwayCentrelineFactory.Make(); FixedColourRunwayCentreline fifth = FixedColourRunwayCentrelineFactory.Make(); sectorElements.Add(first); sectorElements.Add(second); sectorElements.Add(third); sectorElements.Add(fourth); sectorElements.Add(fifth); IEnumerable <ICompilableElementProvider> expected = new List <ICompilableElementProvider>() { first, third, second, fifth, fourth }; AssertCollectedItems(expected); }
public void TestItAddsGeo() { Geo geo = GeoFactory.Make(); collection.Add(geo); Assert.Equal(geo, collection.GeoElements[0]); }
public GeonFilter(string[] acceptable) { this.acceptable = acceptable; geo = GeoFactory.Open(with => { with.Source(new MaxMindSource()); with.Format(new ZipFormat()); with.Reader(new CsvReader()); }); }
public void TestItFailsOnInvalidColourIntegers() { sectorElements.Add(GeoFactory.Make( "123456789", new List <GeoSegment> { GeoSegmentFactory.Make(colour: "123456789"), } )); AssertValidationErrors(2); }
public void TestItFailsOnInvalidDefinedColours() { sectorElements.Add(GeoFactory.Make( "notcolour1", new List <GeoSegment> { GeoSegmentFactory.Make(colour: "notcolour1"), } )); AssertValidationErrors(2); }
public void TestItPassesOnValidDefinedColours() { sectorElements.Add(GeoFactory.Make( "colour1", new List <GeoSegment> { GeoSegmentFactory.Make(colour: "colour1"), } )); AssertNoValidationErrors(); }
public void TestItPassesOnValidColoursIntegers() { sectorElements.Add(GeoFactory.Make( "55", new List <GeoSegment> { GeoSegmentFactory.Make(colour: "42"), } )); AssertNoValidationErrors(); }
public void BasicTest() { const double latitudeOfBerlin = 52.518639; const double longitudeOfBerlin = 13.376090; var locationFactory = new GeoFactory(); var locationOfBerlin = locationFactory.CreateLocation(latitudeOfBerlin, longitudeOfBerlin); var googleMapsLink = locationOfBerlin.ToGoogleMapsLink(); var bingLink = locationOfBerlin.ToBingMapsLink(); var openStreetMapsLink = locationOfBerlin.ToOpenStreetMapsLink(); Assert.NotEmpty(googleMapsLink); Assert.NotEmpty(bingLink); Assert.NotEmpty(openStreetMapsLink); }
public void TestCreateLocation() { var fac = new GeoFactory(); var loc = fac.CreateLocation(0.0, 0.0); Assert.Equal(0.0, loc.Latitude); Assert.Equal(0.0, loc.Longitude); // passive assert: this lines must not throw an exception fac.CreateLocation(-90.0, -180); // min. values fac.CreateLocation(90.0, 180.0); // max. values Assert.Throws <ArgumentOutOfRangeException>(() => fac.CreateLocation(-90.1, 0.0)); Assert.Throws <ArgumentOutOfRangeException>(() => fac.CreateLocation(90.1, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => fac.CreateLocation(0, -180.1)); Assert.Throws <ArgumentOutOfRangeException>(() => fac.CreateLocation(0, 180.1)); }
public void BasicTest() { var fac = new GeoFactory(); var berlinCircle = fac.CreateCircle(DecimalLatitudeOfBerlin, DecimalLongitudeOfBerlin, 500); var leftLink = berlinCircle.Left().ToGoogleMapsLink(); var centerLink = berlinCircle.ToGoogleMapsLink(); var rightLink = berlinCircle.Right().ToGoogleMapsLink(); var topLink = berlinCircle.Top().ToGoogleMapsLink(); var bottomLink = berlinCircle.Bottom().ToGoogleMapsLink(); var sb = new StringBuilder(); sb.AppendLine(leftLink); sb.AppendLine(centerLink); sb.AppendLine(rightLink); sb.AppendLine(topLink); sb.AppendLine(bottomLink); }
public void TestGeoLocationFactory() { var factory = new GeoFactory(); var geoBerlin = factory.CreateLocation(DecimalLatitudeOfBerlin, DecimalLongitudeOfBerlin); var latBerlin = geoBerlin.LatitudeDMS; var lonBerlin = geoBerlin.LongitudeDMS; Assert.Equal(52, latBerlin.Degrees); Assert.Equal(31, latBerlin.Minutes); Assert.Equal(7.1, Math.Round(latBerlin.Seconds, 3, MidpointRounding.AwayFromZero)); Assert.Equal(13, lonBerlin.Degrees); Assert.Equal(22, lonBerlin.Minutes); Assert.Equal(33.924, Math.Round(lonBerlin.Seconds, 3, MidpointRounding.AwayFromZero)); Assert.Equal("N 52° 31' 07.1\"", geoBerlin.LatitudeDMS.WriteToString()); Assert.Equal("E 13° 22' 33.9\"", geoBerlin.LongitudeDMS.WriteToString()); geoBerlin.LongitudeDMS.WriteToString(); }
public void TestItFailsOnInvalidPoint() { sectorElements.Add(GeoFactory.Make( firstPoint: new Point("nottestndb"), secondPoint: new Point("testairport"), additionalSegments: new List <GeoSegment> { GeoSegmentFactory.Make(firstPoint: new Point("nottestvor"), secondPoint: new Point("testfix")), } )); sectorElements.Add(GeoFactory.Make( firstPoint: new Point("testndb"), secondPoint: new Point("nottestairport"), additionalSegments: new List <GeoSegment> { GeoSegmentFactory.Make(firstPoint: new Point("testvor"), secondPoint: new Point("nottestfix")), } )); AssertValidationErrors(4); }
public static ILocation GenerateLocation(double longitude1, double latitude1, double longitude2, double latitude2) { return(GeoFactory.GenerateLocation(longitude1, latitude1, longitude2, latitude2)); }
public static ILocation GenerateLocation(ICoordinates coordinates1, ICoordinates coordinates2) { return(GeoFactory.GenerateLocation(coordinates1, coordinates2)); }
// Factory public static ICoordinates GenerateCoordinates(double longitude, double latitude) { return(GeoFactory.GenerateCoordinates(longitude, latitude)); }