public static IDictionary<string, object> Write(Action<IMediaNode> configuration)
        {
            var node = new DictionaryMediaNode();
            configuration(node);

            return node.Values;
        }
        public IMediaNode Add()
        {
            var node = new DictionaryMediaNode();
            _list.Add(node.Values);

            return node;
        }
Example #3
0
        public static IDictionary <string, object> Write(Action <IMediaNode> configuration)
        {
            var node = new DictionaryMediaNode();

            configuration(node);

            return(node.Values);
        }
Example #4
0
        public IMediaNode Add()
        {
            var node = new DictionaryMediaNode();

            _list.Add(node.Values);

            return(node);
        }
        public void should_just_use_IProjectMyself_Project_in_accessor_projection()
        {
            var projection = AccessorProjection<ComplexValueHolder, ComplexValue>.For(x => x.Value);
            var target = new ComplexValueHolder
            {
                Value = new ComplexValue {Name = "Jeremy", Age = 38}
            };

            var context = new ProjectionContext<ComplexValueHolder>(new InMemoryServiceLocator(), target);

            var node = new DictionaryMediaNode();
            projection.As<IProjection<ComplexValueHolder>>().Write(context, node);

            node.Values["Value"].As<IDictionary<string, object>>()["Name"].ShouldEqual("Jeremy");
            node.Values["Value"].As<IDictionary<string, object>>()["Age"].ShouldEqual(38);
        }
        public void project_the_property_with_formatting_thru_display_formatter()
        {
            var projection = new Projection<Address>(DisplayFormatting.UseDisplayFormatting);
            projection.Value(x => x.Line1);

            var services = MockRepository.GenerateMock<IServiceLocator>();
            var formatter = MockRepository.GenerateMock<IDisplayFormatter>();
            services.Stub(x => x.GetInstance<IDisplayFormatter>()).Return(formatter);

            var accessor = ReflectionHelper.GetAccessor<Address>(x => x.Line1);
            var theFormattedValue = "formatted value";

            formatter.Stub(x => x.GetDisplayForValue(accessor, anAddress.Line1)).Return(theFormattedValue);

            var node = new DictionaryMediaNode();
            projection.As<IProjection<Address>>().Write(new ProjectionContext<Address>(services, aTarget), node);
            node.Values["Line1"].ShouldEqual(theFormattedValue);
        }
 public void SetUp()
 {
     theNode = new DictionaryMediaNode();
 }