コード例 #1
0
        public void Ctor_InitializesProperty_EdmType()
        {
            IEdmStructuredTypeReference edmType = new Mock<IEdmStructuredTypeReference>().Object;

            EdmStructuredObject edmObject = new EdmStructuredObject(42, edmType);

            Assert.Same(edmType, edmObject.EdmType);
        }
コード例 #2
0
        public void TryGetValue_ReturnsFalse_IfInstanceIsNull()
        {
            IEdmStructuredTypeReference edmType = new Mock<IEdmStructuredTypeReference>().Object;
            EdmStructuredObject edmObject = new EdmStructuredObject(instance: null, edmType: edmType);
            object value;

            Assert.False(edmObject.TryGetValue("property", out value));
            Assert.Null(value);
        }
コード例 #3
0
        public void GetEdmType_Returns_InitializedEdmType()
        {
            IEdmStructuredTypeReference edmType = new Mock<IEdmStructuredTypeReference>().Object;
            EdmStructuredObject edmObject = new EdmStructuredObject(42, edmType);

            IEdmTypeReference result = edmObject.GetEdmType();

            Assert.Same(edmType, edmObject.EdmType);
        }
コード例 #4
0
        public void Ctor_InitializesProperty_Instance()
        {
            object instance = new object();
            IEdmStructuredTypeReference edmType = new Mock<IEdmStructuredTypeReference>().Object;

            EdmStructuredObject edmObject = new EdmStructuredObject(instance, edmType);

            Assert.Same(instance, edmObject.Instance);
        }
コード例 #5
0
        public void TryGetValue_ReturnsFalse_IfPropertyIsNotPresent()
        {
            TestEntity instance = new TestEntity { Property = new object() };
            IEdmStructuredTypeReference edmType = new Mock<IEdmStructuredTypeReference>().Object;
            EdmStructuredObject edmObject = new EdmStructuredObject(instance, edmType);
            object value;

            Assert.False(edmObject.TryGetValue("NotPresentProperty", out value));
            Assert.Null(value);
        }