public void GetEdmType_ThrowsArgumentException_IfArgumentNotNull()
        {
            // Arrange
            var             segment = new UnboundFunctionPathSegment("GetTopCustomer", parameterValues: null);
            Mock <IEdmType> edmType = new Mock <IEdmType>();

            // Act & Assert
            Assert.Throws <ArgumentException>(() => segment.GetEdmType(edmType.Object));
        }
        public void GetEdmType_ReturnsNotNull_PrimitiveReturnType()
        {
            // Arrange
            IEdmFunctionImport         functionImport = _container.FindOperationImports("MyFunction").SingleOrDefault() as IEdmFunctionImport;
            UnboundFunctionPathSegment segment        = new UnboundFunctionPathSegment(functionImport, _model, parameterValues: null);

            // Act
            var result = segment.GetEdmType(previousEdmType: null);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("Edm.String", result.FullTypeName());
        }
        public void GetEdmType_ReturnsNotNull_EntityType()
        {
            // Arrange
            IEdmFunctionImport         functionImport = _container.FindOperationImports("TopCustomer").SingleOrDefault() as IEdmFunctionImport;
            UnboundFunctionPathSegment segment        = new UnboundFunctionPathSegment(functionImport, _model, parameterValues: null);

            // Act
            var result = segment.GetEdmType(previousEdmType: null);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("System.Web.OData.Routing.MyCustomer", result.FullTypeName());
        }
        public void GetEdmType_ReturnsNotNull_PrimitiveReturnType()
        {
            // Arrange
            IEdmFunctionImport functionImport = _container.FindOperationImports("MyFunction").SingleOrDefault() as IEdmFunctionImport;
            UnboundFunctionPathSegment segment = new UnboundFunctionPathSegment(functionImport, _model, parameterValues: null);

            // Act
            var result = segment.GetEdmType(previousEdmType: null);

            // Assert
            Assert.NotNull(result);
            Assert.Equal("Edm.String", result.FullTypeName());
        }
        public void GetEdmType_ReturnsNotNull_EntityType()
        {
            // Arrange
            IEdmFunctionImport functionImport = _container.FindOperationImports("TopCustomer").SingleOrDefault() as IEdmFunctionImport;
            UnboundFunctionPathSegment segment = new UnboundFunctionPathSegment(functionImport, _model, parameterValues: null);

            // Act
            var result = segment.GetEdmType(previousEdmType: null);
            
            // Assert
            Assert.NotNull(result);
            Assert.Equal("System.Web.OData.Routing.MyCustomer", result.FullTypeName());
        }
        public void GetEdmType_ThrowsArgumentException_IfArgumentNotNull()
        {
            // Arrange
            var segment = new UnboundFunctionPathSegment("GetTopCustomer", parameterValues: null);
            Mock<IEdmType> edmType = new Mock<IEdmType>();

            // Act & Assert
            Assert.Throws<ArgumentException>(() => segment.GetEdmType(edmType.Object));
        }