public void TryTranslateCastSegmentTemplate_ThrowsArgumentNull_Context()
        {
            // Arrange
            EdmEntityType       baseType = new EdmEntityType("NS", "base");
            EdmEntityType       subType  = new EdmEntityType("NS", "sub", baseType);
            CastSegmentTemplate segment  = new CastSegmentTemplate(subType, baseType, null);

            // Act & Assert
            ExceptionAssert.ThrowsArgumentNull(() => segment.TryTranslate(null), "context");
        }
        public void TryTranslateCastSegmentTemplate_ReturnsODataTypeSegment()
        {
            // Arrange
            EdmEntityType                 baseType = new EdmEntityType("NS", "base");
            EdmEntityType                 subType  = new EdmEntityType("NS", "sub", baseType);
            CastSegmentTemplate           template = new CastSegmentTemplate(subType, baseType, null);
            ODataTemplateTranslateContext context  = new ODataTemplateTranslateContext();

            // Act
            bool ok = template.TryTranslate(context);

            // Assert
            Assert.True(ok);
            ODataPathSegment actual      = Assert.Single(context.Segments);
            TypeSegment      typeSegment = Assert.IsType <TypeSegment>(actual);

            Assert.Same(subType, typeSegment.EdmType);
        }