Skip to content

Commit

Permalink
Improve docs & tests. Upgrade package version.
Browse files Browse the repository at this point in the history
  • Loading branch information
CXuesong committed Aug 30, 2018
1 parent eaeb772 commit 2afd905
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions UnitTestProject1/Tests/SiteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public async Task TestWpTest2()
Assert.Equal("Wikipedia", site.SiteInfo.SiteName);
Assert.Equal("Main Page", site.SiteInfo.MainPage);
Assert.Equal("https://test2.wikipedia.org/wiki/test%20page", site.SiteInfo.MakeArticleUrl("test page"));
Assert.Equal("https://test2.wikipedia.org/wiki/test%20page%20(DAB)", site.SiteInfo.MakeArticleUrl("test page (DAB)"));
var messages = await site.GetMessagesAsync(new[] {"august"});
Assert.Equal("August", messages["august"]);
ValidateNamespaces(site);
Expand Down
13 changes: 11 additions & 2 deletions WikiClientLibrary/Sites/SiteInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ public class SiteInfo
/// </summary>
/// <param name="title">The title of the article.</param>
/// <exception cref="ArgumentNullException"><paramref name="title"/> is <c>null</c>.</exception>
/// <remarks>This overload uses <c>https:</c> as default protocol for protocol-relative.</remarks>
/// <remarks>
/// This overload uses <c>https:</c> as default protocol for protocol-relative URL.
/// For wiki sites with specified-protocol <see cref="ServerUrl"/>, such as Wikia (which uses http),
/// this overload respects the server-chosen protocol.
/// </remarks>
public string MakeArticleUrl(string title)
{
return MakeArticleUrl(title, "https");
Expand All @@ -85,10 +89,15 @@ public string MakeArticleUrl(string title)
/// Makes the full URL to the page of specified title.
/// </summary>
/// <param name="title">The title of the article.</param>
/// <param name="defaultProtocol">For protocol-relative URL (e.g. <c>//en.wikipedia.org/</c>),
/// <param name="defaultProtocol">
/// For wiki sites whose <see cref="ServerUrl"/> is protocol-relative URL (e.g. <c>//en.wikipedia.org/</c>),
/// specifies the default protocol to use. (e.g. <c>https</c>)</param>
/// <exception cref="ArgumentNullException">Either <paramref name="title"/> or <paramref name="defaultProtocol"/> is <c>null</c>.</exception>
/// <returns>The full URL of the article.</returns>
/// <remarks>
/// For wiki sites with specified-protocol <see cref="ServerUrl"/>, such as Wikia (which uses http),
/// this overload respects the server-chosen protocol.
/// </remarks>
public string MakeArticleUrl(string title, string defaultProtocol)
{
if (title == null) throw new ArgumentNullException(nameof(title));
Expand Down
6 changes: 3 additions & 3 deletions WikiClientLibrary/WikiClientLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<TargetFrameworks>netstandard1.1;netstandard2.0</TargetFrameworks>
<AssemblyName>WikiClientLibrary</AssemblyName>
<PackageId>CXuesong.MW.WikiClientLibrary</PackageId>
<Version>0.6.3</Version>
<AssemblyVersion>0.6.3.0</AssemblyVersion>
<FileVersion>0.6.3.0</FileVersion>
<Version>0.6.4</Version>
<AssemblyVersion>0.6.4.0</AssemblyVersion>
<FileVersion>0.6.4.0</FileVersion>
<Copyright>Copyright (C) CXuesong 2018</Copyright>
<Description>
Wiki Client Library is a .NET Standard &amp; asynchronous client library for MediaWiki sites.
Expand Down

0 comments on commit 2afd905

Please sign in to comment.