public void GetDefaultOptionsFromProcessingContext_AlwaysReturnsInstanceEvenIfSetToNull()
        {
            var config  = new Configuration();
            var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true);

            context.SetTextOptions((TextOptions)null);
            TextOptions ctxOptions = context.GetTextOptions();

            Assert.NotNull(ctxOptions);
        }
        public void SetDefaultOptionsOnProcessingContext()
        {
            var option  = new TextOptions();
            var config  = new Configuration();
            var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true);

            context.SetTextOptions(option);

            // sets the prop on the processing context not on the configuration
            Assert.Equal(option, context.Properties[typeof(TextOptions)]);
            Assert.DoesNotContain(typeof(TextOptions), config.Properties.Keys);
        }
        public void UpdateDefaultOptionsOnProcessingContext_AlwaysNewInstance()
        {
            var option = new TextOptions()
            {
                TabWidth = 99
            };
            var config  = new Configuration();
            var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true);

            context.SetTextOptions(option);

            context.SetTextOptions(o =>
            {
                Assert.Equal(99, o.TabWidth); // has origional values
                o.TabWidth = 9;
            });

            TextOptions returnedOption = context.GetTextOptions();

            Assert.Equal(9, returnedOption.TabWidth);
            Assert.Equal(99, option.TabWidth); // hasn't been mutated
        }