mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-09-23 15:34:24 +00:00
Start filling in URL builder tests
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using SabreTools.RedumpLib.Web;
|
||||
using Xunit;
|
||||
|
||||
@@ -11,6 +7,15 @@ namespace SabreTools.RedumpLib.Test.Web
|
||||
{
|
||||
#region BuildDiscUrl
|
||||
|
||||
[Theory]
|
||||
[InlineData(1, 1)]
|
||||
[InlineData(-1, 1)]
|
||||
public void BuildDiscUrl_AlwaysPositive(int id, int expected)
|
||||
{
|
||||
string actual = UrlBuilder.BuildDiscUrl(id);
|
||||
Assert.Equal($"http://redump.org/disc/{expected}/", actual);
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
|
||||
#endregion
|
||||
@@ -23,13 +28,23 @@ namespace SabreTools.RedumpLib.Test.Web
|
||||
|
||||
#region BuildDiscsWipUrl
|
||||
|
||||
// TODO: Implement
|
||||
[Fact]
|
||||
public void BuildDiscsWipUrl_Constant()
|
||||
{
|
||||
string actual = UrlBuilder.BuildDiscsWipUrl();
|
||||
Assert.Equal("http://redump.org/discs-wip/", actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BuildDownloadsUrl
|
||||
|
||||
// TODO: Implement
|
||||
[Fact]
|
||||
public void BuildDownloadsUrl_Constant()
|
||||
{
|
||||
string actual = UrlBuilder.BuildDownloadsUrl();
|
||||
Assert.Equal("http://redump.org/downloads/", actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,13 +56,25 @@ namespace SabreTools.RedumpLib.Test.Web
|
||||
|
||||
#region BuildMemberPromotionUrl
|
||||
|
||||
// TODO: Implement
|
||||
[Fact]
|
||||
public void BuildMemberPromotionUrl_Constant()
|
||||
{
|
||||
string actual = UrlBuilder.BuildMemberPromotionUrl();
|
||||
Assert.Equal("http://redump.org/member2dumper/", actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BuildNewDiscUrl
|
||||
|
||||
// TODO: Implement
|
||||
[Theory]
|
||||
[InlineData(1, 1)]
|
||||
[InlineData(-1, 1)]
|
||||
public void BuildNewDiscUrl_AlwaysPositive(int id, int expected)
|
||||
{
|
||||
string actual = UrlBuilder.BuildNewDiscUrl(id);
|
||||
Assert.Equal($"http://redump.org/newdisc/{expected}/", actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace SabreTools.RedumpLib.Web
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append(SiteBaseUrl);
|
||||
sb.AppendFormat(DiscPath, +id);
|
||||
sb.AppendFormat(DiscPath, Math.Abs(id));
|
||||
|
||||
if (changes)
|
||||
sb.Append(DiscPathChangesSubpath);
|
||||
@@ -498,7 +498,7 @@ namespace SabreTools.RedumpLib.Web
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append(SiteBaseUrl);
|
||||
sb.AppendFormat(NewDiscPath, +id);
|
||||
sb.AppendFormat(NewDiscPath, Math.Abs(id));
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user