public void TryGetValue_ReturnsValueFromInstance_IfNotPresentInContainer() { object expectedPropertyValue = new object(); MockPropertyContainer container = new MockPropertyContainer(); SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity> { Model = _model.Model, Container = container }; wrapper.Instance = new TestEntity { SampleProperty = expectedPropertyValue }; wrapper.UseInstanceForProperties = true; object value; bool result = wrapper.TryGetPropertyValue("SampleProperty", out value); Assert.True(result); Assert.Same(expectedPropertyValue, value); }
public void ToDictionary_ContainsAllProperties_FromContainer() { // Arrange EdmModel model = new EdmModel(); EdmEntityType entityType = new EdmEntityType("NS", "Name"); model.AddElement(entityType); model.SetAnnotationValue(entityType, new ClrTypeAnnotation(typeof(TestEntity))); entityType.AddStructuralProperty("SampleProperty", EdmPrimitiveTypeKind.Int32); MockPropertyContainer container = new MockPropertyContainer(); container.Properties.Add("Property", 42); SelectExpandWrapper <TestEntity> wrapper = new SelectExpandWrapper <TestEntity> { Container = container, Model = model }; // Act var result = wrapper.ToDictionary(); // Assert Assert.Equal(42, result["Property"]); }