Exemplo n.º 1
0
 public void IsCreateResourceMethodNoReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(body: new Parameter()
     {
         Location = ParameterLocation.Body
     })));
 }
Exemplo n.º 2
0
 public void IsCreateResourceMethodWithCompositeNonResourceReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                  body: new Parameter()
     {
         Location = ParameterLocation.Body
     },
                                                                  responseBody: new CompositeType())));
 }
Exemplo n.º 3
0
 public void IsCreateResourceMethodWithNonResourceReturnType()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(
                                                                  body: new Parameter()
     {
         Location = ParameterLocation.Body
     },
                                                                  responseBody: new PrimaryType(KnownPrimaryType.Int))));
 }
Exemplo 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)));
        }
Exemplo 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")));
        }
Exemplo 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}")));
        }
Exemplo n.º 7
0
 public void IsCreateResourceMethodWithNoBody()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod()));
 }
Exemplo n.º 8
0
 public void IsCreateResourceMethodWithGetHttpMethod()
 {
     Assert.False(ResourceSchemaParser.IsCreateResourceMethod(CreateMethod(HttpMethod.Get)));
 }
Exemplo n.º 9
0
 public void IsCreateResourceMethodWithNullMethod()
 {
     Assert.Throws <ArgumentNullException>(() => { ResourceSchemaParser.IsCreateResourceMethod(null); });
 }