public void TryGetValue_ReturnsFalse_IfInstanceIsNull() { // Arrange IEdmEntityTypeReference edmType = new Mock <IEdmEntityTypeReference>().Object; IEdmModel edmModel = new Mock <IEdmModel>().Object; TypedEdmEntityObject edmObject = new TypedEdmEntityObject(instance: null, edmType: edmType, edmModel: edmModel); object value; // Act & Assert Assert.False(edmObject.TryGetPropertyValue("property", out value)); Assert.Null(value); }
public void TryGetValue_ReturnsFalse_IfPropertyIsNotPresent() { // Arrange TestEntity instance = new TestEntity { Property = new object() }; Mock <IEdmEntityTypeReference> mockEdmType = new Mock <IEdmEntityTypeReference>(); mockEdmType.Setup(t => t.Definition).Returns(new Mock <IEdmStructuredType>().Object); IEdmEntityTypeReference edmType = mockEdmType.Object; IEdmModel edmModel = new Mock <IEdmModel>().Object; TypedEdmEntityObject edmObject = new TypedEdmEntityObject(instance, edmType, edmModel); object value; // Act & Assert Assert.False(edmObject.TryGetPropertyValue("NotPresentProperty", out value)); Assert.Null(value); }