public void Foo() { var sut = new GeoLocationBox(); var formatter = Substitute.For <ISupportGeoLocationBox>(); sut.GeoLocationSupport = formatter; sut.OpenInGeoAppClick(null, null); sut.SetToCurrentLocationClick(null, null); }
private static void UpdateControl( GeoLocationBox glb, NZazuCoordinate val, ISupportGeoLocationBox support) { glb.SetToCurrentLocation.Visibility = support != null && support.HasCurrentPosition ? Visibility.Visible : Visibility.Collapsed; glb.OpenInGeoApp.Visibility = support != null && support.CanOpenGeoApp ? Visibility.Visible : Visibility.Collapsed; glb.OpenInGeoApp.IsEnabled = val != null && support != null && support.CanOpenGeoApp; glb.LocationBox.IsEnabled = support != null; glb.LocationBox.Text = support?.ToString(val) ?? "no valid coordinate converter added"; }
public void Be_Creatable() { var sut = new GeoLocationBox(); // we need to set the formatter first (so we don't get an exception if the default formatter is wrong var formatter = Substitute.For <ISupportGeoLocationBox>(); sut.GeoLocationSupport.Should().BeNull(); sut.GeoLocationSupport = formatter; sut.GeoLocationSupport.Should().Be(formatter); sut.Value.Should().Be(null); sut.Value = new NZazuCoordinate { Lat = 53.1, Lon = 7.2 }; sut.Value.Lat.Should().Be(53.1); sut.Value.Lon.Should().Be(7.2); sut.IsReadOnly.Should().BeFalse(); sut.IsReadOnly = true; sut.IsReadOnly.Should().BeTrue(); }