Exemplo n.º 1
0
        public void CreateSwaggerPathForOperationImport_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerPathForOperationImport(_getCustomers);

            // Assert
            Assert.NotNull(obj);
            Assert.Contains("\"Call operation import  GetCustomers\"", obj.ToString());
        }
Exemplo n.º 2
0
        public void CreateSwaggerPathForOperationOfEntity_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerPathForOperationOfEntity(_isCustomerUpgradedWithParam, _customers);

            // Assert
            Assert.NotNull(obj);
            Assert.Contains("\"Call operation  IsUpgradedWithParam\"", obj.ToString());
        }
Exemplo n.º 3
0
        public void CreateSwaggerPathForEntitySet_ReturnsEmptyObject_IfNavigationSourceNull()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerPathForEntitySet(navigationSource: null);

            // Assert
            Assert.NotNull(obj);
            Assert.Equal(new JObject(), obj);
        }
Exemplo n.º 4
0
        public void CreateSwaggerPathForEntity_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerPathForEntity(_customers);

            // Assert
            Assert.NotNull(obj);
            Assert.Contains("\"Get entity from Customers by key.\"", obj.ToString());
        }
Exemplo n.º 5
0
        public void CreateSwaggerDefinitionForStructureType_ReturnsSwaggerObject()
        {
            // Arrange & Act
            JObject obj = ODataSwaggerUtilities.CreateSwaggerTypeDefinitionForStructuredType(_customer);

            // Assert
            Assert.NotNull(obj);
            Assert.Contains("\"$ref\": \"#/definitions/NS.Address\"", obj.ToString());
        }
Exemplo n.º 6
0
        public void GetPathForOperationOfEntity_Returns()
        {
            // Arrange & Act
            string path = ODataSwaggerUtilities.GetPathForOperationOfEntity(_isCustomerUpgradedWithParam, _customers);

            // Assert
            Assert.NotNull(path);
            Assert.Equal("/Customers({ID})/NS.IsUpgradedWithParam(city='{city}')", path);
        }
Exemplo n.º 7
0
        public void GetPathForOperationOfEntitySet_Returns()
        {
            // Arrange & Act
            string path = ODataSwaggerUtilities.GetPathForOperationOfEntitySet(_isAnyUpgraded, _customers);

            // Assert
            Assert.NotNull(path);
            Assert.Equal("/Customers/NS.IsAnyUpgraded()", path);
        }
Exemplo n.º 8
0
        public void GetPathForOperationImport_Returns()
        {
            // Arrange & Act
            string path = ODataSwaggerUtilities.GetPathForOperationImport(_getCustomers);

            // Assert
            Assert.NotNull(path);
            Assert.Equal("/GetCustomers()", path);
        }
Exemplo n.º 9
0
        public void GetPathForEntity_Returns()
        {
            // Arrange & Act
            string path = ODataSwaggerUtilities.GetPathForEntity(_customers);

            // Assert
            Assert.NotNull(path);
            Assert.Equal("/Customers({ID})", path);
        }
Exemplo n.º 10
0
        public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
        {
            Contract.Assume(operation != null);
            Contract.Assume(schemaRegistry != null);
            Contract.Assume(apiDescription != null);

            if (HasEnableQueryAttribute(apiDescription) && !HasAnyQueryOptionParameters(operation))
            {
                operation.parameters = ODataSwaggerUtilities.AddQueryOptionParameters(operation.parameters ?? new List <Parameter>());
            }
        }