You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
12 years ago
|
using System;
|
||
13 years ago
|
using System.IO;
|
||
|
using FluentAssertions;
|
||
|
using NUnit.Framework;
|
||
|
using NzbDrone.Common;
|
||
|
using NzbDrone.Core.Test.Framework;
|
||
|
|
||
12 years ago
|
namespace NzbDrone.Core.Test.UpdateTests
|
||
13 years ago
|
{
|
||
12 years ago
|
class GetUpdateLogFixture : CoreTest
|
||
13 years ago
|
{
|
||
|
String UpdateLogFolder;
|
||
|
|
||
|
|
||
|
[SetUp]
|
||
|
public void setup()
|
||
|
{
|
||
|
WithTempAsAppPath();
|
||
|
|
||
13 years ago
|
UpdateLogFolder = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateLogFolder();
|
||
13 years ago
|
|
||
|
Mocker.GetMock<DiskProvider>()
|
||
|
.Setup(c => c.GetFiles(UpdateLogFolder, SearchOption.TopDirectoryOnly))
|
||
13 years ago
|
.Returns(new []
|
||
13 years ago
|
{
|
||
|
"C:\\nzbdrone\\update\\2011.09.20-19-08.txt",
|
||
|
"C:\\nzbdrone\\update\\2011.10.20-20-08.txt",
|
||
|
"C:\\nzbdrone\\update\\2011.12.20-21-08.txt"
|
||
|
});
|
||
|
|
||
|
Mocker.GetMock<DiskProvider>()
|
||
|
.Setup(c => c.FolderExists(UpdateLogFolder))
|
||
|
.Returns(true);
|
||
|
}
|
||
|
|
||
|
|
||
|
[Test]
|
||
|
public void get_logs_should_return_empty_list_if_directory_doesnt_exist()
|
||
|
{
|
||
|
Mocker.GetMock<DiskProvider>()
|
||
|
.Setup(c => c.FolderExists(UpdateLogFolder))
|
||
|
.Returns(false);
|
||
|
|
||
12 years ago
|
var logs = Mocker.Resolve<UpdateService>().UpdateLogFile();
|
||
13 years ago
|
logs.Should().BeEmpty();
|
||
|
}
|
||
|
|
||
|
|
||
|
[Test]
|
||
|
public void get_logs_should_return_list_of_files_in_log_folder()
|
||
|
{
|
||
12 years ago
|
var logs = Mocker.Resolve<UpdateService>().UpdateLogFile();
|
||
13 years ago
|
logs.Should().HaveCount(3);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|