public void Constructor_WithNonWmtsMapDataConfiguration_PropertiesHaveExpectedAttributesValues() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call var properties = new BackgroundDataProperties(backgroundData); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(3, dynamicProperties.Count); PropertyDescriptor nameProperty = dynamicProperties[requiredNamePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, "Algemeen", "Omschrijving", "Omschrijving van de achtergrond kaartlaag.", true); PropertyDescriptor transparencyPropertyIndex = dynamicProperties[requiredTransparencyPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(transparencyPropertyIndex, "Algemeen", "Transparantie", "Transparantie waarmee de achtergrond kaartlaag wordt weergegeven."); PropertyDescriptor visibilityProperty = dynamicProperties[requiredVisibilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(visibilityProperty, "Algemeen", "Weergeven", "Geeft aan of de geselecteerde achtergrond kaartlaag in alle kaarten van dit traject wordt weergegeven."); }
public void GetProperties_BackgroundDataWithConfiguredWmtsConfiguration_ReturnExpectedValues() { // Setup WmtsMapData mapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); var backgroundData = new BackgroundData(new WmtsBackgroundDataConfiguration(mapData.IsConfigured, mapData.SourceCapabilitiesUrl, mapData.SelectedCapabilityIdentifier, mapData.PreferredFormat)) { IsVisible = false, Transparency = (RoundedDouble)0.5, Name = mapData.Name }; // Call var properties = new BackgroundDataProperties(backgroundData); // Assert Assert.AreEqual(backgroundData.IsVisible, properties.IsVisible); Assert.AreEqual(backgroundData.Transparency, properties.Transparency); Assert.AreEqual(mapData.Name, properties.Name); Assert.AreEqual(mapData.SourceCapabilitiesUrl, properties.SourceCapabilitiesUrl); Assert.AreEqual(mapData.SelectedCapabilityIdentifier, properties.SelectedCapabilityIdentifier); Assert.AreEqual(mapData.PreferredFormat, properties.PreferredFormat); }
public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() { // Setup const int numberOfChangedProperties = 2; var mockRepository = new MockRepository(); var observer = mockRepository.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()).Repeat.Times(numberOfChangedProperties); mockRepository.ReplayAll(); var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); backgroundData.Attach(observer); var properties = new BackgroundDataProperties(backgroundData); var random = new Random(123); bool newVisibility = random.NextBoolean(); RoundedDouble newTransparency = random.NextRoundedDouble(); // Call properties.IsVisible = newVisibility; properties.Transparency = newTransparency; // Assert Assert.AreEqual(newTransparency, properties.Transparency, properties.Transparency.GetAccuracy()); Assert.AreEqual(newVisibility, properties.IsVisible); mockRepository.VerifyAll(); }
public void Constructor_ValidBackgroundData_ExpectedValues() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call var properties = new BackgroundDataProperties(backgroundData); // Assert Assert.IsInstanceOf <ObjectProperties <BackgroundData> >(properties); Assert.AreSame(backgroundData, properties.Data); }
public void GetProperties_BackgroundDataWithUnconfiguredWmtsConfiguration_ReturnExpectedValues() { // Setup var backgroundData = new BackgroundData(new WmtsBackgroundDataConfiguration()) { IsVisible = false, Transparency = (RoundedDouble)0.5 }; // Call var properties = new BackgroundDataProperties(backgroundData); // Assert Assert.AreEqual(backgroundData.IsVisible, properties.IsVisible); Assert.AreEqual(backgroundData.Transparency, properties.Transparency); Assert.IsEmpty(properties.Name); Assert.IsEmpty(properties.SourceCapabilitiesUrl); Assert.IsEmpty(properties.SelectedCapabilityIdentifier); Assert.IsEmpty(properties.PreferredFormat); }
public void GetProperties_BackgroundDataWellKnownConfiguration_ReturnExpectedValues() { // Setup const string name = "A"; var mapData = new TestImageBasedMapData(name, false); var backgroundData = new BackgroundData(new WellKnownBackgroundDataConfiguration(RiskeerWellKnownTileSource.BingAerial)) { Name = mapData.Name, Transparency = mapData.Transparency, IsVisible = mapData.IsVisible }; // Call var properties = new BackgroundDataProperties(backgroundData); // Assert Assert.AreEqual(backgroundData.IsVisible, properties.IsVisible); Assert.AreEqual(backgroundData.Transparency, properties.Transparency); Assert.AreEqual(mapData.Name, properties.Name); }
public void Constructor_WithConfiguredWmtsMapDataConfiguration_PropertiesHaveExpectedAttributesValues() { // Setup WmtsMapData defaultPdokMapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); var backgroundData = new BackgroundData(new WmtsBackgroundDataConfiguration(defaultPdokMapData.IsConfigured, defaultPdokMapData.SourceCapabilitiesUrl, defaultPdokMapData.SelectedCapabilityIdentifier, defaultPdokMapData.PreferredFormat)) { Name = defaultPdokMapData.Name, Transparency = defaultPdokMapData.Transparency, IsVisible = defaultPdokMapData.IsVisible }; // Call var properties = new BackgroundDataProperties(backgroundData); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(6, dynamicProperties.Count); PropertyDescriptor nameProperty = dynamicProperties[requiredNamePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, "Algemeen", "Omschrijving", "Omschrijving van de achtergrond kaartlaag.", true); PropertyDescriptor transparencyPropertyIndex = dynamicProperties[requiredTransparencyPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(transparencyPropertyIndex, "Algemeen", "Transparantie", "Transparantie waarmee de achtergrond kaartlaag wordt weergegeven."); PropertyDescriptor visibilityProperty = dynamicProperties[requiredVisibilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(visibilityProperty, "Algemeen", "Weergeven", "Geeft aan of de geselecteerde achtergrond kaartlaag in alle kaarten van dit traject wordt weergegeven."); const string wmtsCategory = "WMTS"; PropertyDescriptor urlProperty = dynamicProperties[wmtsUrlPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(urlProperty, wmtsCategory, "URL", "Volledige URL naar de Web Map Tile Service (WMTS) die als achtergrond kaartlaag gebruikt wordt.", true); PropertyDescriptor selectedCapabilityProperty = dynamicProperties[wmtsSelectedCapabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(selectedCapabilityProperty, wmtsCategory, "Kaartlaag", "De naam van de geselecteerde kaartlaag.", true); PropertyDescriptor preferredFormatProperty = dynamicProperties[wmtsPreferredFormatPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(preferredFormatProperty, wmtsCategory, "Formaat", "Het type afbeelding die door de geselecteerde kaartlaag aangeleverd wordt.", true); }