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.Equal(expectedUri.ToString(), actualUri); }
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.Equal(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.Equal(expectedUri.ToString(), actualUri); }
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); }