Duplicate File Locator 1.0
Loading...
Searching...
No Matches
DuplicateFileLocatorTests.cs
Go to the documentation of this file.
3using NUnit.Framework;
4
6{
7 [TestFixture]
9 {
10 [Test]
12 {
13 string testJson = "C:\\Users\\Alexa\\repos\\duplicate-file-locator\\test.json";
14 using (StreamWriter sw = File.CreateText(testJson))
15 {
16 sw.WriteLine();
17 }
18
19 IDuplicateFileLocator duplicateFileLocator = new DuplicateFileLocator(testJson);
20
21 Assert.That(duplicateFileLocator, Is.Not.Null);
22 }
23
24 [Test]
25 public void FindDuplicateFiles()
26 {
27 string testJson = "C:\\Users\\Alexa\\repos\\duplicate-file-locator\\test.json";
28 using (StreamWriter sw = File.CreateText(testJson))
29 {
30 sw.WriteLine();
31 }
32
33 IDuplicateFileLocator duplicateFileLocator = new DuplicateFileLocator(testJson);
34
35 duplicateFileLocator.FindDuplicateFiles("C:\\Users\\Alexa\\repos\\duplicate-file-locator\\test_files");
36
37 string jsonResults = string.Empty;
38 using (StreamReader sr = new StreamReader("C:\\Users\\Alexa\\repos\\duplicate-file-locator\\test.json"))
39 {
40 jsonResults = sr.ReadToEnd();
41 }
42
43 string jsonExpected = string.Empty;
44 using (StreamReader sr = new StreamReader("C:\\Users\\Alexa\\repos\\duplicate-file-locator\\test-expected.json"))
45 {
46 jsonExpected = sr.ReadToEnd();
47 }
48
49 Assert.That(jsonResults, Is.EqualTo(jsonExpected));
50 }
51 }
52}
void FindDuplicateFiles(string dir)
Method searches recursively to find duplicated files.