|
|
@ -80,5 +80,89 @@ namespace NzbDrone.Core.Test
|
|
|
|
Console.WriteLine(dateTime.DayOfWeek);
|
|
|
|
Console.WriteLine(dateTime.DayOfWeek);
|
|
|
|
dateTime.ToBestDateString().Should().Be(dateTime.ToShortDateString());
|
|
|
|
dateTime.ToBestDateString().Should().Be(dateTime.ToShortDateString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_self_if_already_parent()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be(url);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_parent_url_when_path_is_passed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com/test/";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be("http://www.nzbdrone.com");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_parent_url_when_multiple_paths_are_passed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com/test/test2";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be("http://www.nzbdrone.com");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_parent_url_when_url_with_query_string_is_passed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com/test.aspx?test=10";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be("http://www.nzbdrone.com");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_parent_url_when_url_with_path_and_query_strings_is_passed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com/tester/test.aspx?test=10";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be("http://www.nzbdrone.com");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void ParentUriString_should_return_parent_url_when_url_with_query_strings_is_passed()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var url = "http://www.nzbdrone.com/test.aspx?test=10&test2=5";
|
|
|
|
|
|
|
|
var uri = new Uri(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var result = uri.ParentUriString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Resolve
|
|
|
|
|
|
|
|
result.Should().Be("http://www.nzbdrone.com");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|