mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Directory write time is now calculated based on the most recent file write to any file inside of that directory.
This commit is contained in:
parent
a68c882032
commit
ead5f37921
4 changed files with 60 additions and 7 deletions
|
@ -1,5 +1,6 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
@ -151,6 +152,29 @@ namespace NzbDrone.Common.Test
|
|||
DiskProvider.PathEquals(first, second).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void empty_folder_should_return_folder_modified_date()
|
||||
{
|
||||
var tempfolder = new DirectoryInfo(TempFolder);
|
||||
Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(TempFolder).Should().Be(tempfolder.LastWriteTimeUtc);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void folder_should_return_correct_value_for_last_write()
|
||||
{
|
||||
var appPath = new EnviromentProvider().ApplicationPath;
|
||||
Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(appPath).Should().BeOnOrAfter(DateTime.UtcNow.AddMinutes(-10));
|
||||
Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(appPath).Should().BeBefore(DateTime.UtcNow);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Explicit]
|
||||
public void check_last_write()
|
||||
{
|
||||
Console.WriteLine(Mocker.Resolve<DiskProvider>().GetLastDirectoryWrite(@"C:\DRIVERS"));
|
||||
Console.WriteLine(new DirectoryInfo(@"C:\DRIVERS").LastWriteTimeUtc);
|
||||
}
|
||||
|
||||
private void VerifyCopy()
|
||||
{
|
||||
BinFolder.Refresh();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue