diff --git a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.projitems b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.projitems index 48dc3409f..0da11cb8d 100644 --- a/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.projitems +++ b/DeviceTests/DeviceTests.Shared/DeviceTests.Shared.projitems @@ -24,6 +24,7 @@ + diff --git a/DeviceTests/DeviceTests.Shared/Maps_Tests.cs b/DeviceTests/DeviceTests.Shared/Maps_Tests.cs new file mode 100644 index 000000000..cf1e0a9c8 --- /dev/null +++ b/DeviceTests/DeviceTests.Shared/Maps_Tests.cs @@ -0,0 +1,69 @@ +using System; +using System.Threading.Tasks; +using Xamarin.Essentials; +using Xunit; + +namespace DeviceTests +{ + public class Maps_Tests + { + const double testLatitude = 47.645160; + const double testLongitude = -122.1306032; + const string mapName = "Microsoft Building 25"; + + [Fact] + [Trait(Traits.InteractionType, Traits.InteractionTypes.Human)] + public async Task LaunchMap_CoordinatesDisplayCorrectPlace() + { + await Maps.OpenAsync(testLatitude, testLongitude, new MapsLaunchOptions { Name = mapName }); + } + + [Fact] + [Trait(Traits.InteractionType, Traits.InteractionTypes.Human)] + public async Task LaunchMap_PlacemarkDisplayCorrectPlace() + { + var placemark = new Placemark + { + CountryName = "United States", + AdminArea = "WA", + Thoroughfare = "Microsoft Building 25", + Locality = "Redmond" + }; + await Maps.OpenAsync(placemark, new MapsLaunchOptions { Name = mapName }); + } + + [Fact] + public async Task LaunchMap_NullLocation() + { + Location location = null; + await Assert.ThrowsAsync(() => Maps.OpenAsync(location)); + } + + [Fact] + public async Task LaunchMap_NullOptionsLocation() + { + var location = new Location(testLatitude, testLongitude); + await Assert.ThrowsAsync(() => Maps.OpenAsync(location, null)); + } + + [Fact] + public async Task LaunchMap_NullPlacemark() + { + Placemark location = null; + await Assert.ThrowsAsync(() => Maps.OpenAsync(location)); + } + + [Fact] + public async Task LaunchMap_NullOptionsPlacemark() + { + var placemark = new Placemark + { + CountryName = "United States", + AdminArea = "WA", + Thoroughfare = "Microsoft Building 25", + Locality = "Redmond" + }; + await Assert.ThrowsAsync(() => Maps.OpenAsync(placemark, null)); + } + } +} diff --git a/Samples/Samples/View/MapsPage.xaml b/Samples/Samples/View/MapsPage.xaml new file mode 100644 index 000000000..9c7aae675 --- /dev/null +++ b/Samples/Samples/View/MapsPage.xaml @@ -0,0 +1,44 @@ + + + + + + + +