2012-12-19 16:41:51 +00:00
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Ninject;
|
|
|
|
|
using NzbDrone.Common;
|
2012-12-23 01:18:05 +00:00
|
|
|
|
using NzbDrone.Core.Helpers;
|
2012-12-19 16:41:51 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
using TvdbLib.Data;
|
|
|
|
|
using TvdbLib.Exceptions;
|
|
|
|
|
|
2012-12-23 01:18:05 +00:00
|
|
|
|
namespace NzbDrone.Core.Test.HelperTests.XElementHelperTests
|
2012-12-19 16:41:51 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
public class ParseDayOfWeekFixture : CoreTest
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_null_if_xelement_is_null()
|
|
|
|
|
{
|
2012-12-23 01:18:05 +00:00
|
|
|
|
XElement test = null;
|
|
|
|
|
test.ConvertToDayOfWeek().Should().Be(null);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_null_if_value_is_null()
|
|
|
|
|
{
|
2012-12-23 01:18:05 +00:00
|
|
|
|
new XElement("airday", null).ConvertToDayOfWeek().Should().Be(null);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_null_if_value_is_empty()
|
|
|
|
|
{
|
2012-12-23 01:18:05 +00:00
|
|
|
|
new XElement("airday", "").ConvertToDayOfWeek().Should().Be(null);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_null_if_value_is_daily()
|
|
|
|
|
{
|
2012-12-23 01:18:05 +00:00
|
|
|
|
new XElement("airday", "Daily").ConvertToDayOfWeek().Should().Be(null);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_null_if_value_is_weekdays()
|
|
|
|
|
{
|
2012-12-23 05:40:07 +00:00
|
|
|
|
new XElement("airday", "Weekdays").ConvertToDayOfWeek().Should().Be(null);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase("Sunday", DayOfWeek.Sunday)]
|
|
|
|
|
[TestCase("Monday", DayOfWeek.Monday)]
|
|
|
|
|
[TestCase("Tuesday", DayOfWeek.Tuesday)]
|
|
|
|
|
[TestCase("Wednesday", DayOfWeek.Wednesday)]
|
|
|
|
|
[TestCase("Thursday", DayOfWeek.Thursday)]
|
|
|
|
|
[TestCase("Friday", DayOfWeek.Friday)]
|
|
|
|
|
[TestCase("Saturday", DayOfWeek.Saturday)]
|
|
|
|
|
public void should_return_dayOfWeek_when_it_is_valid(string value, DayOfWeek expected)
|
|
|
|
|
{
|
2012-12-23 01:18:05 +00:00
|
|
|
|
new XElement("airday", value).ConvertToDayOfWeek().Should().Be(expected);
|
2012-12-19 16:41:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|