public void CombinatorCreatesNewInstance() { LegendConfigurator a = new(); LegendConfigurator b = new(); Combinator <LegendConfigurator> combinator = new(a, b); LegendConfigurator combined = combinator.Combine(); Assert.False(ReferenceEquals(a, combined)); Assert.False(ReferenceEquals(b, combined)); }
public void CombinatorDoesNotOverrideSetProperties() { LegendConfigurator a = new(); LegendConfigurator b = new(); const LegendPlacement placement = LegendPlacement.Inside; const LegendPlacement ignoredPlacement = LegendPlacement.Inside; b.Placement.Set(placement); a.Placement.Set(ignoredPlacement); Combinator <LegendConfigurator> combinator = new(a, b); LegendConfigurator combined = combinator.Combine(); Assert.True(combined.Placement.IsSet); Assert.Equal(placement, combined.Placement.Value); }
public void CombinatorAddsDeclaredProperties() { LegendConfigurator a = new(); LegendConfigurator b = new(); const LegendPlacement placement = LegendPlacement.Inside; const LegendPosition position = LegendPosition.LeftTop; b.Placement.Set(placement); a.Position.Set(position); Combinator <LegendConfigurator> combinator = new(a, b); LegendConfigurator combined = combinator.Combine(); Assert.True(combined.Placement.IsSet); Assert.True(combined.Position.IsSet); Assert.Equal(placement, combined.Placement.Value); Assert.Equal(position, combined.Position.Value); }
/// <summary> /// Sets the legend placement. /// </summary> /// <param name="legend">The legend to configure.</param> /// <param name="placement">The placement.</param> public static LegendConfigurator SetPlacement(this LegendConfigurator legend, LegendPlacement placement) => legend.Set(l => l.Placement, placement);
/// <summary> /// Sets the legend position. /// </summary> /// <param name="legend">The legend to configure.</param> /// <param name="position">The position.</param> public static LegendConfigurator SetPosition(this LegendConfigurator legend, LegendPosition position) => legend.Set(l => l.Position, position);