public void GetUniquePartUriTest(string contentType, string parentUri, string targetUri, string expectedOnce, string expectedTwice) { var helper = new PartUriHelper(); var unique = helper.GetUniquePartUri(contentType, new Uri(parentUri, UriKind.Relative), new Uri(targetUri, UriKind.Relative)); Assert.Equal(new Uri(expectedOnce, UriKind.Relative), unique); var unique2 = helper.GetUniquePartUri(contentType, new Uri(parentUri, UriKind.Relative), new Uri(targetUri, UriKind.Relative)); Assert.Equal(new Uri(expectedTwice, UriKind.Relative), unique2); }
public void ReserveUriTest(string contentType, string parentUri, string targetUri, string expected, string expected2) { // We don't use this in the test, but it comes as part of the shared data set and parameter usage is enforced Assert.NotNull(expected); var helper = new PartUriHelper(); var partUri = PackUriHelper.ResolvePartUri(new Uri(parentUri, UriKind.Relative), new Uri(targetUri, UriKind.Relative)); helper.ReserveUri(contentType, partUri); var unique = helper.GetUniquePartUri(contentType, partUri, ".", Path.GetFileNameWithoutExtension(targetUri), Path.GetExtension(targetUri)); Assert.Equal(new Uri(expected2, UriKind.Relative), unique); }
public void GetUniquePartUri5Arg(string contentType, string parentUri, string targetUri, string expectedOnce, string expectedTwice) { var helper = new PartUriHelper(); var unique1 = helper.GetUniquePartUri( contentType, PackUriHelper.ResolvePartUri(new Uri(parentUri, UriKind.Relative), new Uri(targetUri, UriKind.Relative)), ".", Path.GetFileNameWithoutExtension(targetUri), Path.GetExtension(targetUri)); Assert.Equal(new Uri(expectedOnce, UriKind.Relative), unique1); var unique2 = helper.GetUniquePartUri( contentType, PackUriHelper.ResolvePartUri(new Uri(parentUri, UriKind.Relative), new Uri(targetUri, UriKind.Relative)), ".", Path.GetFileNameWithoutExtension(targetUri), Path.GetExtension(targetUri)); Assert.Equal(new Uri(expectedTwice, UriKind.Relative), unique2); }