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_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 GetEdmType_Returns_InitializedEdmType() { // Arrange IEdmEntityTypeReference edmType = new Mock<IEdmEntityTypeReference>().Object; IEdmModel edmModel = new Mock<IEdmModel>().Object; TypedEdmEntityObject edmObject = new TypedEdmEntityObject(42, edmType, edmModel); // Act IEdmTypeReference result = edmObject.GetEdmType(); // Assert Assert.Same(edmType, result); }
public void Ctor_InitializesProperty_Instance() { // Arrange object instance = new object(); IEdmEntityTypeReference edmType = new Mock<IEdmEntityTypeReference>().Object; IEdmModel edmModel = new Mock<IEdmModel>().Object; // Act TypedEdmEntityObject edmObject = new TypedEdmEntityObject(instance, edmType, edmModel); // Assert Assert.Same(instance, edmObject.Instance); }
public void GetEdmType_Returns_InitializedEdmType() { // Arrange IEdmEntityTypeReference edmType = new Mock <IEdmEntityTypeReference>().Object; IEdmModel edmModel = new Mock <IEdmModel>().Object; TypedEdmEntityObject edmObject = new TypedEdmEntityObject(42, edmType, edmModel); // Act IEdmTypeReference result = edmObject.GetEdmType(); // Assert Assert.Same(edmType, result); }
public void Ctor_InitializesProperty_Instance() { // Arrange object instance = new object(); IEdmEntityTypeReference edmType = new Mock <IEdmEntityTypeReference>().Object; IEdmModel edmModel = new Mock <IEdmModel>().Object; // Act TypedEdmEntityObject edmObject = new TypedEdmEntityObject(instance, edmType, edmModel); // Assert Assert.Same(instance, edmObject.Instance); }
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); }
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); }