Esempio n. 1
0
 public void IsCreateResourceMethodNoReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(body: new Parameter()
     {
         Location = ParameterLocation.Body
     })));
 }
Esempio n. 2
0
 public void IsCreateResourceMethodWithCompositeNonResourceReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                  body: new Parameter()
     {
         Location = ParameterLocation.Body
     },
                                                                  responseBody: new CompositeType())));
 }
Esempio n. 3
0
 public void IsCreateResourceMethodWithNonResourceReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                  body: new Parameter()
     {
         Location = ParameterLocation.Body
     },
                                                                  responseBody: new PrimaryType(KnownPrimaryType.Int))));
 }
Esempio n. 4
0
        public void IsCreateResourceMethodWithResourceReturnTypeButNoUrl()
        {
            CompositeType responseBody = new CompositeType();

            responseBody.Extensions.Add("x-ms-azure-resource", true);

            Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                         body: new Parameter()
            {
                Location = ParameterLocation.Body
            },
                                                                         responseBody: responseBody)));
        }
Esempio n. 5
0
        public void IsCreateResourceMethodWhenUrlDoesntEndWithResourceNamePlaceholder()
        {
            CompositeType responseBody = new CompositeType();

            responseBody.Extensions.Add("x-ms-azure-resource", true);

            Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                         body: new Parameter()
            {
                Location = ParameterLocation.Body
            },
                                                                         responseBody: responseBody,
                                                                         url: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/slotConfigNames")));
        }
Esempio n. 6
0
        public void IsCreateResourceMethodWithResourceReturnTypeAndUrl()
        {
            CompositeType responseBody = new CompositeType();

            responseBody.Extensions.Add("x-ms-azure-resource", true);

            Assert.True(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                        body: new Parameter()
            {
                Location = ParameterLocation.Body
            },
                                                                        responseBody: responseBody,
                                                                        url: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Mock.Provider/mockResourceNames/{mockResourceName}")));
        }
Esempio n. 7
0
 public void IsCreateResourceMethodWithNoBody()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod()));
 }
Esempio n. 8
0
 public void IsCreateResourceMethodWithGetHttpMethod()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(HttpMethod.Get)));
 }
Esempio n. 9
0
 public void IsCreateResourceMethodWithNullMethod()
 {
     Assert.Throws <ArgumentNullException>(() => { ResourceSchemaParser.IsCreateResourceMethod(null); });
 }