mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-27 23:06:29 -04:00
Fix .gitattributes and normalize to LF in repository
Existing `*text eol=lf` is malformed (no space after *) so does nothing. CONTRIBUTING.md states 'We checkout Windows and commit *nix'. The correct way to achieve this is `* text=auto`. `* text eol=lf` would force line endings to LF on checkout. See: https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Settostringvaluelf
This commit is contained in:
@@ -1,84 +1,84 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.TvTests.SeriesServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdateMultipleSeriesFixture : CoreTest<SeriesService>
|
||||
{
|
||||
private List<Series> _series;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_series = Builder<Series>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(s => s.QualityProfileId = 1)
|
||||
.With(s => s.Monitored)
|
||||
.With(s => s.SeasonFolder)
|
||||
.With(s => s.Path = @"C:\Test\name".AsOsAgnostic())
|
||||
.With(s => s.RootFolderPath = "")
|
||||
.Build().ToList();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_repo_updateMany()
|
||||
{
|
||||
Subject.UpdateSeries(_series, false);
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Verify(v => v.UpdateMany(_series), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_update_path_when_rootFolderPath_is_supplied()
|
||||
{
|
||||
var newRoot = @"C:\Test\TV2".AsOsAgnostic();
|
||||
_series.ForEach(s => s.RootFolderPath = newRoot);
|
||||
|
||||
Mocker.GetMock<IBuildSeriesPaths>()
|
||||
.Setup(s => s.BuildPath(It.IsAny<Series>(), false))
|
||||
.Returns<Series, bool>((s, u) => Path.Combine(s.RootFolderPath, s.Title));
|
||||
|
||||
Subject.UpdateSeries(_series, false).ForEach(s => s.Path.Should().StartWith(newRoot));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_update_path_when_rootFolderPath_is_empty()
|
||||
{
|
||||
Subject.UpdateSeries(_series, false).ForEach(s =>
|
||||
{
|
||||
var expectedPath = _series.Single(ser => ser.Id == s.Id).Path;
|
||||
s.Path.Should().Be(expectedPath);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_update_many_series()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(50)
|
||||
.All()
|
||||
.With(s => s.Path = (@"C:\Test\TV\" + s.Path).AsOsAgnostic())
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
var newRoot = @"C:\Test\TV2".AsOsAgnostic();
|
||||
series.ForEach(s => s.RootFolderPath = newRoot);
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetSeriesFolder(It.IsAny<Series>(), (NamingConfig)null))
|
||||
.Returns<Series, NamingConfig>((s, n) => s.Title);
|
||||
|
||||
Subject.UpdateSeries(series, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.TvTests.SeriesServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdateMultipleSeriesFixture : CoreTest<SeriesService>
|
||||
{
|
||||
private List<Series> _series;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_series = Builder<Series>.CreateListOfSize(5)
|
||||
.All()
|
||||
.With(s => s.QualityProfileId = 1)
|
||||
.With(s => s.Monitored)
|
||||
.With(s => s.SeasonFolder)
|
||||
.With(s => s.Path = @"C:\Test\name".AsOsAgnostic())
|
||||
.With(s => s.RootFolderPath = "")
|
||||
.Build().ToList();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_repo_updateMany()
|
||||
{
|
||||
Subject.UpdateSeries(_series, false);
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Verify(v => v.UpdateMany(_series), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_update_path_when_rootFolderPath_is_supplied()
|
||||
{
|
||||
var newRoot = @"C:\Test\TV2".AsOsAgnostic();
|
||||
_series.ForEach(s => s.RootFolderPath = newRoot);
|
||||
|
||||
Mocker.GetMock<IBuildSeriesPaths>()
|
||||
.Setup(s => s.BuildPath(It.IsAny<Series>(), false))
|
||||
.Returns<Series, bool>((s, u) => Path.Combine(s.RootFolderPath, s.Title));
|
||||
|
||||
Subject.UpdateSeries(_series, false).ForEach(s => s.Path.Should().StartWith(newRoot));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_update_path_when_rootFolderPath_is_empty()
|
||||
{
|
||||
Subject.UpdateSeries(_series, false).ForEach(s =>
|
||||
{
|
||||
var expectedPath = _series.Single(ser => ser.Id == s.Id).Path;
|
||||
s.Path.Should().Be(expectedPath);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_update_many_series()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(50)
|
||||
.All()
|
||||
.With(s => s.Path = (@"C:\Test\TV\" + s.Path).AsOsAgnostic())
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
var newRoot = @"C:\Test\TV2".AsOsAgnostic();
|
||||
series.ForEach(s => s.RootFolderPath = newRoot);
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetSeriesFolder(It.IsAny<Series>(), (NamingConfig)null))
|
||||
.Returns<Series, NamingConfig>((s, n) => s.Title);
|
||||
|
||||
Subject.UpdateSeries(series, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.TvTests.SeriesServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdateSeriesFixture : CoreTest<SeriesService>
|
||||
{
|
||||
private Series _fakeSeries;
|
||||
private Series _existingSeries;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
_existingSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
_fakeSeries.Seasons = new List<Season>
|
||||
{
|
||||
new Season{ SeasonNumber = 1, Monitored = true },
|
||||
new Season{ SeasonNumber = 2, Monitored = true }
|
||||
};
|
||||
|
||||
_existingSeries.Seasons = new List<Season>
|
||||
{
|
||||
new Season{ SeasonNumber = 1, Monitored = true },
|
||||
new Season{ SeasonNumber = 2, Monitored = true }
|
||||
};
|
||||
}
|
||||
|
||||
private void GivenExistingSeries()
|
||||
{
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(It.IsAny<int>()))
|
||||
.Returns(_existingSeries);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_update_episodes_if_season_hasnt_changed()
|
||||
{
|
||||
GivenExistingSeries();
|
||||
|
||||
Subject.UpdateSeries(_fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, It.IsAny<int>(), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_update_series_when_it_changes()
|
||||
{
|
||||
GivenExistingSeries();
|
||||
var seasonNumber = 1;
|
||||
var monitored = false;
|
||||
|
||||
_fakeSeries.Seasons.Single(s => s.SeasonNumber == seasonNumber).Monitored = monitored;
|
||||
|
||||
Subject.UpdateSeries(_fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, seasonNumber, monitored), Times.Once());
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, It.IsAny<int>(), It.IsAny<bool>()), Times.Once());
|
||||
}
|
||||
}
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.TvTests.SeriesServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdateSeriesFixture : CoreTest<SeriesService>
|
||||
{
|
||||
private Series _fakeSeries;
|
||||
private Series _existingSeries;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
_existingSeries = Builder<Series>.CreateNew().Build();
|
||||
|
||||
_fakeSeries.Seasons = new List<Season>
|
||||
{
|
||||
new Season{ SeasonNumber = 1, Monitored = true },
|
||||
new Season{ SeasonNumber = 2, Monitored = true }
|
||||
};
|
||||
|
||||
_existingSeries.Seasons = new List<Season>
|
||||
{
|
||||
new Season{ SeasonNumber = 1, Monitored = true },
|
||||
new Season{ SeasonNumber = 2, Monitored = true }
|
||||
};
|
||||
}
|
||||
|
||||
private void GivenExistingSeries()
|
||||
{
|
||||
Mocker.GetMock<ISeriesRepository>()
|
||||
.Setup(s => s.Get(It.IsAny<int>()))
|
||||
.Returns(_existingSeries);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_update_episodes_if_season_hasnt_changed()
|
||||
{
|
||||
GivenExistingSeries();
|
||||
|
||||
Subject.UpdateSeries(_fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, It.IsAny<int>(), It.IsAny<bool>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_update_series_when_it_changes()
|
||||
{
|
||||
GivenExistingSeries();
|
||||
var seasonNumber = 1;
|
||||
var monitored = false;
|
||||
|
||||
_fakeSeries.Seasons.Single(s => s.SeasonNumber == seasonNumber).Monitored = monitored;
|
||||
|
||||
Subject.UpdateSeries(_fakeSeries);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, seasonNumber, monitored), Times.Once());
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.SetEpisodeMonitoredBySeason(_fakeSeries.Id, It.IsAny<int>(), It.IsAny<bool>()), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user