Пример #1
0
        public void entityView_getCustomPropertyValue_using_never_used_custom_property_should_use_initial_value_interceptor_once()
        {
            var           expected    = 1;
            var           actual      = 0;
            Func <string> interceptor = () =>
            {
                actual++;
                return("initial value");
            };

            var target = new EntityView <Object>(new[] { new Object() });

            target.AddPropertyMapping <string>("Foo", e =>
            {
                return(e.Item.GetCustomValue <string>(e.PropertyName));
            }, interceptor);

            var item = target.FirstOrDefault();

            item.GetCustomValue <string>("Foo");
            item.GetCustomValue <string>("Foo");
            item.GetCustomValue <string>("Foo");

            actual.Should("Not yet implemented").Be.EqualTo(expected);
        }
Пример #2
0
        public void entityView_getCustomPropertyValue_should_return_initial_interceptor_value()
        {
            var expected = "initial value";
            var actual = "";

            Func<String> interceptor = () =>
            {
                return expected;
            };

            var target = new EntityView<Object>( new[] { new Object() } );
            target.AddPropertyMapping<String>( "Foo", e =>
            {
                return e.Item.GetCustomValue<String>( e.PropertyName );
            }, interceptor );

            var item = target.FirstOrDefault();
            actual = item.GetCustomValue<String>( "Foo" );

            actual.Should( "Not yet implemented" ).Be.EqualTo( expected );
        }
Пример #3
0
        public void entityView_getCustomPropertyValue_should_return_initial_interceptor_value()
        {
            var expected = "initial value";
            var actual   = "";

            Func <string> interceptor = () =>
            {
                return(expected);
            };

            var target = new EntityView <Object>(new[] { new Object() });

            target.AddPropertyMapping <string>("Foo", e =>
            {
                return(e.Item.GetCustomValue <string>(e.PropertyName));
            }, interceptor);

            var item = target.FirstOrDefault();

            actual = item.GetCustomValue <string>("Foo");

            actual.Should("Not yet implemented").Be.EqualTo(expected);
        }
Пример #4
0
        public void entityView_getCustomPropertyValue_using_never_used_custom_property_should_use_initial_value_interceptor_once()
        {
            var expected = 1;
            var actual = 0;
            Func<String> interceptor = () =>
            {
                actual++;
                return "initial value";
            };

            var target = new EntityView<Object>( new[] { new Object() } );
            target.AddPropertyMapping<String>( "Foo", e =>
            {
                return e.Item.GetCustomValue<String>( e.PropertyName );
            }, interceptor );

            var item = target.FirstOrDefault();
            item.GetCustomValue<String>( "Foo" );
            item.GetCustomValue<String>( "Foo" );
            item.GetCustomValue<String>( "Foo" );

            actual.Should( "Not yet implemented" ).Be.EqualTo( expected );
        }