public void TryGetValue_ReturnsFalse_IfContainerAndInstanceAreNull()
        {
            SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity>();

            object value;
            bool   result = wrapper.TryGetPropertyValue("SampleProperty", out value);

            Assert.False(result);
        }
        public void TryGetValue_ReturnsFalse_IfPropertyNotPresentInElement()
        {
            SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity>();

            object value;
            bool   result = wrapper.TryGetPropertyValue("SampleNotPresentProperty", out value);

            Assert.False(result);
        }
        public void TryGetValue_ReturnsValueFromInstance_IfContainerIsNull()
        {
            object expectedPropertyValue             = new object();
            SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity>();

            wrapper.Instance = new TestEntity {
                SampleProperty = expectedPropertyValue
            };

            object value;
            bool   result = wrapper.TryGetPropertyValue("SampleProperty", out value);

            Assert.True(result);
            Assert.Same(expectedPropertyValue, value);
        }
        public void TryGetValue_ReturnsValueFromPropertyContainer_IfPresent()
        {
            object expectedPropertyValue    = new object();
            MockPropertyContainer container = new MockPropertyContainer();

            container.Properties.Add("SampleProperty", expectedPropertyValue);
            SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity> {
                Container = container
            };

            wrapper.Instance = new TestEntity();

            object value;
            bool   result = wrapper.TryGetPropertyValue("SampleProperty", out value);

            Assert.True(result);
            Assert.Same(expectedPropertyValue, value);
        }