Пример #1
0
        public void adding_a_formatter_is_idempotent()
        {
            var node = new OutputNode(typeof (Address));
            node.AddFormatter<JsonFormatter>();
            node.AddFormatter<JsonFormatter>();
            node.AddFormatter<JsonFormatter>();
            node.AddFormatter<JsonFormatter>();

            node.Writers.Single()
                .ShouldEqual(new WriteWithFormatter(typeof (Address), typeof (JsonFormatter)));
        }
Пример #2
0
        public void adding_a_formatter_is_idempotent()
        {
            var node = new OutputNode(typeof(Address));

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

            node.Writers.Single()
            .ShouldEqual(new WriteWithFormatter(typeof(Address), typeof(JsonFormatter)));
        }
Пример #3
0
        public void UsesFormatter()
        {
            var node = new OutputNode(typeof(Address));

            node.UsesFormatter <XmlFormatter>().ShouldBeFalse();
            node.UsesFormatter <JsonFormatter>().ShouldBeFalse();

            node.AddFormatter <XmlFormatter>();

            node.UsesFormatter <XmlFormatter>().ShouldBeTrue();
            node.UsesFormatter <JsonFormatter>().ShouldBeFalse();

            node.AddFormatter <JsonFormatter>();

            node.UsesFormatter <XmlFormatter>().ShouldBeTrue();
            node.UsesFormatter <JsonFormatter>().ShouldBeTrue();
        }
Пример #4
0
        public void UsesFormatter()
        {
            var node = new OutputNode(typeof(Address));

            node.UsesFormatter<XmlFormatter>().ShouldBeFalse();
            node.UsesFormatter<JsonFormatter>().ShouldBeFalse();

            node.AddFormatter<XmlFormatter>();

            node.UsesFormatter<XmlFormatter>().ShouldBeTrue();
            node.UsesFormatter<JsonFormatter>().ShouldBeFalse();

            node.AddFormatter<JsonFormatter>();

            node.UsesFormatter<XmlFormatter>().ShouldBeTrue();
            node.UsesFormatter<JsonFormatter>().ShouldBeTrue();
        }