Skip to content

Commit

Permalink
package hasher - renamed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hlotyaks committed Jan 3, 2020
1 parent 097151b commit 301d21a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
10 changes: 5 additions & 5 deletions GraphBuilder/tests/Graph.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ namespace PackageAnalyzer.Tests
public class GraphTests
{
[TestMethod]
public void SimpleCycleTest1()
public void SimpleGraphCycleTest1()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simplecycle1");

Assert.IsTrue(gb.Graph.IsCyclic);
}

[TestMethod]
public void SimpleCycleTest2()
public void SimpleGraphCycleTest2()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simplecycle2");

Expand All @@ -23,23 +23,23 @@ public void SimpleCycleTest2()


[TestMethod]
public void SimpleCycleTest3()
public void SimplGraphCycleTest3()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simplecycle3");

Assert.IsTrue(gb.Graph.IsCyclic);
}

[TestMethod]
public void SimpleCycleTest4()
public void SimpleGraphCycleTest4()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simplecycle4");

Assert.IsTrue(gb.Graph.IsCyclic);
}

[TestMethod]
public void IntermediateCycleTest1()
public void IntermediateGraphCycleTest1()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("intermediatecycle1");

Expand Down
8 changes: 4 additions & 4 deletions GraphBuilder/tests/GraphBuilder.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class GraphBuilderTests


[TestMethod]
public void SimpleTest1()
public void SimpleGraphBuilderTest1()
{
GraphBuilder gb = new GraphBuilder();

Expand All @@ -29,7 +29,7 @@ public void SimpleTest1()
}

[TestMethod]
public void SimpleTest2()
public void SimpleGraphBuilderTest2()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simple2");

Expand All @@ -42,7 +42,7 @@ public void SimpleTest2()
}

[TestMethod]
public void SimpleTest3()
public void SimpleGraphBuilderTest3()
{
GraphBuilder gb = GraphTestUtilities.PopulateGB("simple3");

Expand All @@ -58,7 +58,7 @@ public void SimpleTest3()

[TestMethod]
[ExpectedException(typeof(GraphBuilderException))]
public void FailTest1()
public void FailGraphBuilderTest1()
{
// tests the top level package field is malformed
GraphBuilder gb = GraphTestUtilities.PopulateGB("failure1");
Expand Down
31 changes: 28 additions & 3 deletions PackageHasher/tests/PackageHaser.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace PackageAnalyzer.Tests
public class PackageHasherTests
{
[TestMethod]
public void SimpleTest1()
public void SimpleHashTest1()
{
PackageHasher ph = new PackageHasher();

string cwd = Directory.GetCurrentDirectory();
string root = $"{cwd}\\testcases\\simple2";
string root = $"{cwd}\\testcases\\simple1";

List<string> paths = new List<string>();
paths.Add($"{root}\\package1");
Expand All @@ -30,7 +30,7 @@ public void SimpleTest1()
}

[TestMethod]
public void SimpleTest2()
public void SimpleHashTest2()
{
PackageHasher ph = new PackageHasher();

Expand All @@ -49,6 +49,31 @@ public void SimpleTest2()
Assert.IsTrue(result.ContainsKey("package1"));
Assert.IsTrue(result.ContainsKey("package2"));
}

[TestMethod]
public void CompareHashTest1()
{
// compare hash of same folder and contents from 2 different roots. Should have the smae hash value.
PackageHasher ph = new PackageHasher();

string cwd = Directory.GetCurrentDirectory();
string root1 = $"{cwd}\\testcases\\simple1";
string root2 = $"{cwd}\\testcases\\simple2";

List<string> paths1 = new List<string>();
paths1.Add($"{root1}\\package1");

List<string> paths2 = new List<string>();
paths2.Add($"{root2}\\package1");

var task1 = Task.Run(async () => await ph.HashFoldersAsync(paths1, root1));
var result1 = task1.Result;

var task2 = Task.Run(async () => await ph.HashFoldersAsync(paths2, root2));
var result2 = task2.Result;

Assert.AreEqual(result1["package1"], result2["package1"]);
}
}

}

0 comments on commit 301d21a

Please sign in to comment.