2013-03-28 22:07:09 +00:00
|
|
|
|
|
2012-12-18 06:41:08 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Common;
|
2013-03-04 05:53:02 +00:00
|
|
|
|
using NzbDrone.Core.MetadataSource;
|
2012-12-18 06:41:08 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2013-03-28 22:07:09 +00:00
|
|
|
|
|
2013-02-17 05:44:06 +00:00
|
|
|
|
public class GetUtcOffsetFixture : CoreTest
|
2012-12-18 06:41:08 +00:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_zero_if_timeZone_is_empty()
|
|
|
|
|
{
|
2013-03-04 05:53:02 +00:00
|
|
|
|
Mocker.Resolve<TvRageProxy>().GetUtcOffset("").Should().Be(0);
|
2012-12-18 06:41:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_return_zero_if_cannot_be_coverted_to_int()
|
|
|
|
|
{
|
2013-03-04 05:53:02 +00:00
|
|
|
|
Mocker.Resolve<TvRageProxy>().GetUtcOffset("adfhadfhdjaf").Should().Be(0);
|
2012-12-18 06:41:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase("GMT-5", -5)]
|
|
|
|
|
[TestCase("GMT+0", 0)]
|
|
|
|
|
[TestCase("GMT+8", 8)]
|
|
|
|
|
public void should_return_offset_when_not_dst(string timezone, int expected)
|
|
|
|
|
{
|
2013-03-04 05:53:02 +00:00
|
|
|
|
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
|
2012-12-18 06:41:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase("GMT-5 +DST", -4)]
|
|
|
|
|
[TestCase("GMT+0 +DST", 1)]
|
|
|
|
|
[TestCase("GMT+8 +DST", 9)]
|
|
|
|
|
public void should_return_offset_plus_one_when_dst(string timezone, int expected)
|
|
|
|
|
{
|
2013-03-04 05:53:02 +00:00
|
|
|
|
Mocker.Resolve<TvRageProxy>().GetUtcOffset(timezone).Should().Be(expected);
|
2012-12-18 06:41:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|