Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover system dir instead of hardcoding in tests #3

Merged
merged 1 commit into from
Apr 15, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions DeltaCompressionDotNet.MsDelta.Tests/MsDeltaCompressionTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Security.Cryptography;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -8,8 +8,8 @@ namespace DeltaCompressionDotNet.MsDelta.Tests
[TestClass]
public class MsDeltaCompressionTests
{
private const string NotepadPath = @"C:\Windows\System32\Notepad.exe";
private const string CalcPath = @"C:\Windows\System32\Calc.exe";
private const string NotepadFileName = "Notepad.exe";
private const string CalcFileName = "Calc.exe";

private readonly string _privateCalcPath = Path.GetTempFileName();
private readonly string _privateDeltaPath = Path.GetTempFileName();
Expand All @@ -20,8 +20,11 @@ public class MsDeltaCompressionTests
[TestInitialize]
public void TestInitialize()
{
CopyFile(CalcPath, _privateCalcPath);
CopyFile(NotepadPath, _privateNotepadPath);
var systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
var notepadPath = Path.Combine(systemPath, NotepadFileName);
var calcPath = Path.Combine(systemPath, CalcFileName);
CopyFile(calcPath, _privateCalcPath);
CopyFile(notepadPath, _privateNotepadPath);

// Hash Calc.exe so we can be sure that the applied patch turns Notepad.exe into Calc.exe
_calcHash = HashFile(_privateCalcPath);
Expand Down Expand Up @@ -76,4 +79,4 @@ public void CreateAndApplyDelta()
CollectionAssert.AreEqual(_calcHash, finalHash);
}
}
}
}