public void GetMostDerivedTypeFromPathWithTypeSegmentAndNullReturnsNull()
        {
            var       segment   = new TypeSegment(HardCodedTestModel.GetHomeAddressType(), null);
            ODataPath odataPath = new ODataPath(segment);
            var       result    = UriEdmHelpers.GetMostDerivedTypeFromPath(odataPath, null);

            Assert.Null(result);
        }
        public void GetMostDerivedTypeFromPathWithMetadataSegmentAndNullReturnsType()
        {
            var       segment   = MetadataSegment.Instance;
            ODataPath odataPath = new ODataPath(segment);
            var       result    = UriEdmHelpers.GetMostDerivedTypeFromPath(odataPath, null);

            Assert.Null(result);
        }
        public void GetMostDerivedTypeFromPathWithTypeSegmentAndInheritedTypeReturnsInheritedType()
        {
            var         segment     = new TypeSegment(HardCodedTestModel.GetHomeAddressType(), null);
            ODataPath   odataPath   = new ODataPath(segment);
            TypeSegment typeSegment = odataPath.FirstSegment as TypeSegment;
            IEdmType    type        = typeSegment.EdmType;

            var result = UriEdmHelpers.GetMostDerivedTypeFromPath(odataPath, type);

            Assert.Equal(type, result);
        }
        public void GetMostDerivedTypeFromPathWithTypeSegmentAndNotInheritedTypeReturnsNotInheritedType()
        {
            var                     segment     = new TypeSegment(HardCodedTestModel.GetHomeAddressType(), null);
            ODataPath               odataPath   = new ODataPath(segment);
            IEdmEntityType          astonishing = new EdmEntityType("AwesomeNamespace", "AstonishingEntity", null, false, false);
            IEdmEntityReferenceType entityRef   = new EdmEntityReferenceType(astonishing);

            var result = UriEdmHelpers.GetMostDerivedTypeFromPath(odataPath, entityRef);

            Assert.Equal(entityRef, result);
        }