public void Constructor_WithMapTheme_ReturnCorrectPropertyValues() { // Setup const string attributeName = "Attribute"; var categoryTheme = new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PolygonStyle()); var mapPolygonData = new MapPolygonData("Test", new PolygonStyle(), new MapTheme <PolygonCategoryTheme>(attributeName, new[] { categoryTheme })); // Call var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>()); // Assert Assert.AreEqual("Categorie", properties.StyleType); Assert.AreEqual(mapPolygonData.ShowLabels, properties.ShowLabels); Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute); Assert.AreEqual(mapPolygonData.MetaData, properties.GetAvailableMetaDataAttributes()); Assert.AreEqual(1, properties.CategoryThemes.Length); PolygonCategoryThemeProperties pointCategoryThemeProperties = properties.CategoryThemes.First(); Assert.AreSame(categoryTheme, pointCategoryThemeProperties.Data); ValueCriterionTestHelper.AssertValueCriterionFormatExpression(attributeName, categoryTheme.Criterion, pointCategoryThemeProperties.Criterion); }
public void Constructor_ExpectedValues() { // Setup ValueCriterion valueCriterion = ValueCriterionTestFactory.CreateValueCriterion(); var style = new PolygonStyle(); // Call var category = new PolygonCategoryTheme(valueCriterion, style); // Assert Assert.IsInstanceOf <CategoryTheme>(category); Assert.AreSame(valueCriterion, category.Criterion); Assert.AreSame(style, category.Style); }
public void Constructor_ExpectedValues() { // Setup var categoryTheme = new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PolygonStyle()); // Call var properties = new PolygonCategoryThemeProperties(categoryTheme, string.Empty, new MapPolygonData("Name")); // Assert Assert.IsInstanceOf <CategoryThemeProperties <PolygonCategoryTheme> >(properties); TestHelper.AssertTypeConverter <PolygonCategoryThemeProperties, ColorTypeConverter>( nameof(PolygonCategoryThemeProperties.FillColor)); TestHelper.AssertTypeConverter <PolygonCategoryThemeProperties, ColorTypeConverter>( nameof(PolygonCategoryThemeProperties.StrokeColor)); }
public void Constructor_Always_ReturnExpectedPropertyValues() { // Setup const string attributeName = "AttributeName"; ValueCriterion valueCriterion = ValueCriterionTestFactory.CreateValueCriterion(); var categoryTheme = new PolygonCategoryTheme(valueCriterion, new PolygonStyle()); var properties = new PolygonCategoryThemeProperties(categoryTheme, attributeName, new MapPolygonData("Name")); // Assert Assert.AreSame(categoryTheme, properties.Data); Assert.AreEqual(categoryTheme.Style.FillColor, properties.FillColor); Assert.AreEqual(categoryTheme.Style.StrokeColor, properties.StrokeColor); Assert.AreEqual(categoryTheme.Style.StrokeThickness, properties.StrokeThickness); ValueCriterionTestHelper.AssertValueCriterionFormatExpression(attributeName, valueCriterion, properties.Criterion); }
public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() { // Setup var random = new Random(21); var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()).Repeat.Times(3); mocks.ReplayAll(); var mapData = new MapPolygonData("Name"); mapData.Attach(observer); var categoryTheme = new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PolygonStyle()); var properties = new PolygonCategoryThemeProperties(categoryTheme, string.Empty, mapData); Color fillColor = Color.FromKnownColor(random.NextEnumValue <KnownColor>()); Color strokeColor = Color.FromKnownColor(random.NextEnumValue <KnownColor>()); int strokeThickness = random.Next(1, 48); // Call properties.FillColor = fillColor; properties.StrokeColor = strokeColor; properties.StrokeThickness = strokeThickness; // Assert PolygonStyle actualStyle = categoryTheme.Style; Assert.AreEqual(fillColor, actualStyle.FillColor); Assert.AreEqual(strokeColor, actualStyle.StrokeColor); Assert.AreEqual(strokeThickness, actualStyle.StrokeThickness); mocks.VerifyAll(); }
public void Constructor_WithValidArguments_PropertiesHaveExpectedAttributeValues() { // Setup var categoryTheme = new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PolygonStyle()); // Call var properties = new PolygonCategoryThemeProperties(categoryTheme, string.Empty, new MapPolygonData("Name")); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(4, dynamicProperties.Count); const string styleCategory = "Stijl"; PropertyDescriptor fillColorProperty = dynamicProperties[fillColorPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(fillColorProperty, styleCategory, "Kleur", "De kleur van de vlakken waarmee deze categorie wordt weergegeven."); PropertyDescriptor strokeColorProperty = dynamicProperties[strokeColorPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty, styleCategory, "Lijnkleur", "De kleur van de lijn van de vlakken waarmee deze categorie wordt weergegeven."); PropertyDescriptor strokeThicknessProperty = dynamicProperties[strokeThicknessPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeThicknessProperty, styleCategory, "Lijndikte", "De dikte van de lijn van de vlakken waarmee deze categorie wordt weergegeven."); }