Пример #1
0
        public void use_specific_formatters()
        {
            theInputNode.UseFormatter <JsonFormatter>();
            theInputNode.UseFormatter <XmlFormatter>();

            theFormatterMediaReader.EnumerableDependenciesOf <IFormatter>()
            .Items
            .Select(x => x.Type)
            .ShouldHaveTheSameElementsAs(typeof(JsonFormatter), typeof(XmlFormatter));
        }
Пример #2
0
        public void adding_a_formatter_is_idempotent()
        {
            var node = new ConnegInputNode(typeof(Address));

            node.UseFormatter <JsonFormatter>();
            node.UseFormatter <JsonFormatter>();
            node.UseFormatter <JsonFormatter>();
            node.UseFormatter <JsonFormatter>();
            node.UseFormatter <JsonFormatter>();

            node.SelectedFormatterTypes.Single().ShouldEqual(typeof(JsonFormatter));
        }
Пример #3
0
        public void use_all_formatters_clears_out_any_previously_selected_formatters()
        {
            var node = new ConnegInputNode(typeof(Address));

            node.UseFormatter <JsonFormatter>();

            node.UseAllFormatters();

            node.SelectedFormatterTypes.Any().ShouldBeFalse();
        }
Пример #4
0
        public void add_a_formatter_changes_the_formatter_usage_to_selected_and_adds_the_reader_to_its_collection()
        {
            var node = new ConnegInputNode(typeof(Address));

            node.UseFormatter <JsonFormatter>();

            node.FormatterUsage.ShouldEqual(FormatterUsage.selected);

            node.SelectedFormatterTypes.Single().ShouldEqual(typeof(JsonFormatter));
        }