This repository has been archived by the owner on Feb 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from hasankhan/pulluri
[client][managed][offline] Support absolute uri in pull same as table.read.
- Loading branch information
Showing
12 changed files
with
247 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
sdk/Managed/src/Microsoft.WindowsAzure.MobileServices/Resources.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...anaged/test/Microsoft.WindowsAzure.MobileServices.Test/UnitTests/Http/HttpUtilityTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
using Microsoft.WindowsAzure.MobileServices.TestFramework; | ||
|
||
namespace Microsoft.WindowsAzure.MobileServices.Test | ||
{ | ||
[Tag("unit")] | ||
[Tag("http")] | ||
public class HttpUtilityTests : TestBase | ||
{ | ||
|
||
[TestMethod] | ||
public static void TryParseQueryUri_ReturnsTrue_WhenQueryIsRelativeOrAbsoluteUri() | ||
{ | ||
var data = new[] | ||
{ | ||
new | ||
{ | ||
ServiceUri = "http://www.test.com", | ||
Query = "/about?$filter=a eq b&$orderby=c", | ||
Absolute = false, | ||
Result = "http://www.test.com/about?$filter=a eq b&$orderby=c" | ||
}, | ||
new | ||
{ | ||
ServiceUri = "http://www.test.com/", | ||
Query = "http://www.test.com/about?$filter=a eq b&$orderby=c", | ||
Absolute = true, | ||
Result = "http://www.test.com/about?$filter=a eq b&$orderby=c" | ||
} | ||
}; | ||
|
||
foreach (var item in data) | ||
{ | ||
Uri result; | ||
bool absolute; | ||
Assert.IsTrue(HttpUtility.TryParseQueryUri(new Uri(item.ServiceUri), item.Query, out result, out absolute)); | ||
Assert.AreEqual(absolute, item.Absolute); | ||
AssertEx.QueryEquals(result.AbsoluteUri, item.Result); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public static void TryParseQueryUri_ReturnsFalse_WhenQueryIsNotRelativeOrAbsoluteUri() | ||
{ | ||
var data = new[] | ||
{ | ||
new | ||
{ | ||
ServiceUri = "http://www.test.com", | ||
Query = "about?$filter=a eq b&$orderby=c", | ||
Result = "http://www.test.com/about?$filter=a eq b&$orderby=c" | ||
}, | ||
new | ||
{ | ||
ServiceUri = "http://www.test.com/", | ||
Query = "$filter=a eq b&$orderby=c", | ||
Result = "http://www.test.com/about?$filter=a eq b&$orderby=c" | ||
} | ||
}; | ||
|
||
foreach (var item in data) | ||
{ | ||
Uri result; | ||
bool absolute; | ||
Assert.IsFalse(HttpUtility.TryParseQueryUri(new Uri(item.ServiceUri), item.Query, out result, out absolute)); | ||
Assert.IsFalse(absolute); | ||
Assert.IsNull(result); | ||
} | ||
} | ||
|
||
[TestMethod] | ||
public void GetUriWithoutQuery_ReturnsUriWithPath() | ||
{ | ||
Tuple<string, string>[] input = new[] | ||
{ | ||
Tuple.Create("http://contoso.com/asdf?$filter=3", "http://contoso.com/asdf"), | ||
Tuple.Create("http://contoso.com/asdf/def?$filter=3", "http://contoso.com/asdf/def"), | ||
Tuple.Create("https://contoso.com/asdf/def?$filter=3", "https://contoso.com/asdf/def") | ||
}; | ||
|
||
foreach (var item in input) | ||
{ | ||
AssertEx.QueryEquals(HttpUtility.GetUriWithoutQuery(new Uri(item.Item1)), item.Item2); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters