public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstanceEvenIfSetToNull() { var config = new Configuration(); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); context.SetShapeOptions((ShapeOptions)null); ShapeOptions ctxOptions = context.GetShapeOptions(); Assert.NotNull(ctxOptions); }
public void SetDefaultOptionsOnProcessingContext() { var option = new ShapeOptions(); var config = new Configuration(); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); context.SetShapeOptions(option); // sets the prop on the processing context not on the configuration Assert.Equal(option, context.Properties[typeof(ShapeOptions)]); Assert.DoesNotContain(typeof(ShapeOptions), config.Properties.Keys); }
public void UpdateDefaultOptionsOnProcessingContext_AlwaysNewInstance() { var option = new ShapeOptions() { IntersectionRule = IntersectionRule.Nonzero }; var config = new Configuration(); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); context.SetShapeOptions(option); context.SetShapeOptions(o => { Assert.Equal(IntersectionRule.Nonzero, o.IntersectionRule); // has origional values o.IntersectionRule = IntersectionRule.OddEven; }); ShapeOptions returnedOption = context.GetShapeOptions(); Assert.Equal(IntersectionRule.OddEven, returnedOption.IntersectionRule); Assert.Equal(IntersectionRule.Nonzero, option.IntersectionRule); // hasn't been mutated }