Пример #1
0
        public WAPackIaaSClient CreateClient(string uriSuffix)
        {
            var client = new WAPackIaaSClient(subscription, channel);

            client.SetUriSuffix(uriSuffix);
            return(client);
        }
        public void ShouldGenerateUriWithUriSuffix()
        {
            const string uriSuffix = "/myResource";

            var expectedUri = new StringBuilder();
            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);

            var client = new WAPackIaaSClient(this.subscription);
            client.SetUriSuffix(uriSuffix);
            var actualUri = client.GetAbsoluteUri();

            Assert.AreEqual(expectedUri.ToString(), actualUri);
        }
Пример #3
0
        public void ShouldGenerateUriWithUriSuffix()
        {
            const string uriSuffix = "/myResource";

            var expectedUri = new StringBuilder();

            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);

            var client = new WAPackIaaSClient(this.subscription);

            client.SetUriSuffix(uriSuffix);
            var actualUri = client.GetAbsoluteUri();

            Assert.Equal(expectedUri.ToString(), actualUri);
        }
Пример #4
0
        public void ShouldGenerateUriWithUriSuffixAndSingleFilter()
        {
            const string uriSuffix  = "/myResource";
            const string filterName = "filterName1";

            var expectedUri = new StringBuilder();

            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.AppendFormat("?$filter={0} eq 'val1'", filterName);

            var client = new WAPackIaaSClient(this.subscription);

            client.SetUriSuffix(uriSuffix);
            client.AddHttpFilter(filterName, WebFilterOptions.eq, "val1");
            var actualUri = client.GetAbsoluteUri();

            Assert.Equal(expectedUri.ToString(), actualUri);
        }
Пример #5
0
        public void ShouldGenerateUriWithUriSuffixAndTwoQueryParameter()
        {
            const string uriSuffix = "/myResource";

            var expectedUri = new StringBuilder();

            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.Append("?query1=value1&query2=value2");

            var client = new WAPackIaaSClient(this.subscription);

            client.SetUriSuffix(uriSuffix);
            client.AddQueryParameters("query1", "value1");
            client.AddQueryParameters("query2", "value2");
            var actualUri = client.GetAbsoluteUri();

            Assert.Equal(expectedUri.ToString(), actualUri);
        }
Пример #6
0
 public WAPackIaaSClient CreateClient(string uriSuffix)
 {
     var client = new WAPackIaaSClient(subscription, channel);
     client.SetUriSuffix(uriSuffix);
     return client;
 }
        public void ShouldGenerateUriWithUriSuffixAndSingleGuidFilter()
        {
            const string uriSuffix = "/myResource";
            const string filterName = "filterName1";

            Guid guidValue = Guid.NewGuid();

            var expectedUri = new StringBuilder();
            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.AppendFormat("?$filter={0} eq guid'{1}'", filterName, guidValue);

            var client = new WAPackIaaSClient(this.subscription);
            client.SetUriSuffix(uriSuffix);
            client.AddHttpFilter(filterName, WebFilterOptions.eq, guidValue.ToString());
            var actualUri = client.GetAbsoluteUri();

            Assert.AreEqual(expectedUri.ToString(), actualUri);
        }
        public void ShouldGenerateUriWithSuffixAndFilterAndQueryParameter()
        {
            const string uriSuffix = "/myResource";
            const string filterName = "filterName1";

            var expectedUri = new StringBuilder();
            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.Append("?query1=value1");
            expectedUri.AppendFormat("&$filter={0} eq 'val1'", filterName);
            
            var client = new WAPackIaaSClient(this.subscription);
            client.SetUriSuffix(uriSuffix);
            client.AddHttpFilter(filterName, WebFilterOptions.eq, "val1");
            client.AddQueryParameters("query1", "value1");

            var actualUri = client.GetAbsoluteUri();

            Assert.AreEqual(expectedUri.ToString(), actualUri);
        }
        public void ShouldGenerateUriWithUriSuffixAndTwoFilters()
        {
            const string uriSuffix = "/myResource";
            const string filterName = "filterName1";
            const string filterName2 = "filterName2";

            var expectedUri = new StringBuilder();
            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.AppendFormat("?$filter={0} eq 'val1' and {1} ne 20", filterName, filterName2);

            var client = new WAPackIaaSClient(this.subscription);
            client.SetUriSuffix(uriSuffix);
            client.AddHttpFilter(filterName, WebFilterOptions.eq, "val1");
            client.AddHttpFilter(filterName2, WebFilterOptions.ne, "20");
            var actualUri = client.GetAbsoluteUri();

            Assert.AreEqual(expectedUri.ToString(), actualUri);
        }
        public void ShouldGenerateUriWithUriSuffixAndTwoQueryParameter()
        {
            const string uriSuffix = "/myResource";

            var expectedUri = new StringBuilder();
            expectedUri.AppendFormat("{0}{1}", this.subscription.ServiceEndpoint, uriSuffix);
            expectedUri.Append("?query1=value1&query2=value2");

            var client = new WAPackIaaSClient(this.subscription);
            client.SetUriSuffix(uriSuffix);
            client.AddQueryParameters("query1", "value1");
            client.AddQueryParameters("query2", "value2");
            var actualUri = client.GetAbsoluteUri();

            Assert.Equal(expectedUri.ToString(), actualUri);
        }