Exemplo n.º 1
0
        public void add_writer_happy_path_with_open_type_and_explicit_condition()
        {
            var condition = new IsAjaxRequest();
            var node      = new OutputNode(typeof(Address));

            node.Add(typeof(FooWriter <>), condition);

            var media = node.Explicits.Single().ShouldBeOfType <Media <Address> >();

            media.Writer.ShouldBeOfType <FooWriter <Address> >();
            media.Condition.ShouldBeTheSameAs(condition);
        }
Exemplo n.º 2
0
        public void add_a_closed_writer_with_conditional()
        {
            var condition = new IsAjaxRequest();
            var writer    = new SpecialWriter();
            var node      = new OutputNode(typeof(Address));

            node.Add(writer, condition);

            var media = node.Explicits.Single().ShouldBeOfType <Media <Address> >();

            media.Writer.ShouldBeTheSameAs(writer);
            media.Condition.ShouldBeTheSameAs(condition);
        }
Exemplo n.º 3
0
        public void add_writer_with_explicit_condition()
        {
            var node         = new OutputNode(typeof(Address));
            var theFormatter = new JsonSerializer();
            var condition    = new IsAjaxRequest();

            node.Add(theFormatter, condition);

            var media = node.Explicits.Single().ShouldBeOfType <Media <Address> >();

            media.Writer.ShouldBeOfType <FormatterWriter <Address> >()
            .Formatter.ShouldBeTheSameAs(theFormatter);

            media.Condition.ShouldBeTheSameAs(condition);
        }