-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
1,463 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...erket.Arkade.Core.Tests/Util/ArchiveFormatValidation/DiasValidation/DiasDirectoryTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Arkivverket.Arkade.Core.Util.ArchiveFormatValidation; | ||
using FluentAssertions; | ||
using Xunit; | ||
|
||
namespace Arkivverket.Arkade.Core.Tests.Util.ArchiveFormatValidation.DiasValidation | ||
{ | ||
public class DiasDirectoryTests | ||
{ | ||
[Fact] | ||
public void GetEntryPathsTest() | ||
{ | ||
var dias = | ||
new DiasDirectory("SomeDiasDirectory", | ||
new DiasDirectory("SomeDiasSubDirectory", | ||
new DiasFile("SomeDiasFile.txt"))); | ||
|
||
IEnumerable<string> entryPaths = dias.GetEntryPaths("SomeDiasDirectory", recursive: true); | ||
|
||
string expectedEntryPath = Path.Combine("SomeDiasDirectory", "SomeDiasSubDirectory", "SomeDiasFile.txt"); | ||
|
||
entryPaths.Should().Contain(e => e.Equals(expectedEntryPath)); | ||
} | ||
|
||
[Fact] | ||
public void GetMissingEntryPathsTest() | ||
{ | ||
DirectoryInfo diasOnDisk = CreateTestDiasDirectory(); | ||
|
||
var dias = | ||
new DiasDirectory(diasOnDisk.FullName, | ||
new DiasDirectory("SomeDiasSubDirectory", | ||
new DiasFile("SomeDiasFile.txt"), | ||
new DiasFile("SomeOtherDiasFile.txt") // Not on disk | ||
)); | ||
|
||
IEnumerable<string> entryPaths = | ||
dias.GetEntryPaths(diasOnDisk.FullName, getNonExistingOnly: true, recursive: true); | ||
|
||
string expectedMissingEntryPath = Path.Combine( | ||
AppDomain.CurrentDomain.BaseDirectory, | ||
"SomeDiasDirectory", | ||
"SomeDiasSubDirectory", | ||
"SomeOtherDiasFile.txt" | ||
); | ||
|
||
entryPaths.Should().Contain(e => e.Equals(expectedMissingEntryPath)); | ||
|
||
diasOnDisk.Delete(true); | ||
} | ||
|
||
private static DirectoryInfo CreateTestDiasDirectory() | ||
{ | ||
DirectoryInfo diasRootDirectory = Directory.CreateDirectory( | ||
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SomeDiasDirectory") | ||
); | ||
|
||
DirectoryInfo testSubDirectory = Directory.CreateDirectory( | ||
Path.Combine(diasRootDirectory.FullName, "SomeDiasSubDirectory") | ||
); | ||
|
||
File.Create(Path.Combine(testSubDirectory.FullName, "SomeDiasFile.txt")).Dispose(); | ||
|
||
return diasRootDirectory; | ||
} | ||
} | ||
} |
Oops, something went wrong.