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

            TextOptions ctxOptions = context.GetTextOptions();

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

            context.Properties[typeof(TextOptions)] = "wronge type";
            TextOptions options = context.GetTextOptions();

            Assert.NotNull(options);
            Assert.IsType <TextOptions>(options);
        }
        public void GetDefaultOptionsFromProcessingContext_FallbackToConfigsInstance()
        {
            var option = new TextOptions();
            var config = new Configuration();

            config.SetTextOptions(option);
            var context = new FakeImageOperationsProvider.FakeImageOperations <Rgba32>(config, null, true);

            TextOptions ctxOptions = context.GetTextOptions();

            Assert.Equal(option, ctxOptions);
        }
        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
        }