public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstance() { var config = new Configuration(); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); ShapeOptions ctxOptions = context.GetShapeOptions(); Assert.NotNull(ctxOptions); }
public void GetDefaultOptionsFromProcessingContext_IgnoreIncorectlyTypesDictionEntry() { var config = new Configuration(); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); context.Properties[typeof(ShapeOptions)] = "wronge type"; ShapeOptions options = context.GetShapeOptions(); Assert.NotNull(options); Assert.IsType <ShapeOptions>(options); }
public void GetDefaultOptionsFromProcessingContext_FallbackToConfigsInstance() { var option = new ShapeOptions(); var config = new Configuration(); config.SetShapeOptions(option); var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true); ShapeOptions ctxOptions = context.GetShapeOptions(); Assert.Equal(option, ctxOptions); }
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 }