-
-
Notifications
You must be signed in to change notification settings - Fork 304
Expand file tree
/
Copy pathCompactorTests.cs
More file actions
38 lines (33 loc) · 1.26 KB
/
CompactorTests.cs
File metadata and controls
38 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Xunit;
using CompactGUI.Core;
using System.IO;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace CompactGUI.Core.Tests
{
public class CompactorTests
{
[Fact]
public async Task BuildWorkingFilesList_WithExclusion_ShouldExcludeCorrectFiles()
{
// Arrange
var tempDir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(tempDir);
var file1 = Path.Combine(tempDir, "test.txt");
var file2 = Path.Combine(tempDir, "test.log");
File.WriteAllText(file1, "This is a test file.");
File.WriteAllText(file2, "This is a log file.");
var analyser = new Analyser(tempDir, null);
var compactor = new Compactor(tempDir, WOFCompressionAlgorithm.XPRESS4K, new[] { ".log" }, analyser, null);
// Act
var fileDetails = (FileDetails)await compactor.BuildWorkingFilesList();
var workingFiles = new List<FileDetails>(fileDetails);
// Assert
Assert.Single(workingFiles);
Assert.Equal(file1, workingFiles[0].FileName);
// Clean up
Directory.Delete(tempDir, true);
}
}
}