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
1 parent
9bc54cb
commit 84ea5e6
Showing
9 changed files
with
62 additions
and
34 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,50 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using cake; | ||
using cake.Tests; | ||
using NUnit.Framework; | ||
|
||
namespace bs.Tests | ||
namespace cake.Tests | ||
{ | ||
[TestFixture] | ||
class SchedulableActionCollectorTest | ||
{ | ||
DependencyGraph _depGraph; | ||
SchedulableActionCollector _collector; | ||
|
||
[SetUp] | ||
public void Setup() | ||
{ | ||
_depGraph = new DependencyGraph(); | ||
_collector = new SchedulableActionCollector(_depGraph); | ||
} | ||
|
||
[Test] | ||
public void CanCollectSingleAction() | ||
{ | ||
var depGraph = new DependencyGraph(); | ||
var a = new SchedulableActionCollector(depGraph); | ||
|
||
var settings = new TargetGenerateSettings(new SimpleAction(s=> { }), new[] {"input"}, "output"); | ||
depGraph.RegisterTarget(settings); | ||
var result = a.CollectActionsToGenerate("output").ToArray(); | ||
_depGraph.RegisterTarget(settings); | ||
var result = _collector.CollectActionsToGenerate("output").ToArray(); | ||
|
||
Assert.AreEqual(1, result.Length); | ||
Assert.AreEqual(settings,result[0].Settings); | ||
Assert.AreEqual(settings, result[0].Settings); | ||
} | ||
|
||
[Test] | ||
public void CanCollectMultipleActions() | ||
{ | ||
var settings1 = new TargetGenerateSettings(new SimpleAction(s => { }), new[] { "file1" }, "file2"); | ||
_depGraph.RegisterTarget(settings1); | ||
|
||
var settings2 = new TargetGenerateSettings(new SimpleAction(s => { }), new[] { "file2" }, "file3"); | ||
_depGraph.RegisterTarget(settings2); | ||
|
||
var result = _collector.CollectActionsToGenerate("file3").ToArray(); | ||
|
||
Assert.AreEqual(2, result.Length); | ||
|
||
//HALP! how to do a more reasonable equivalenec test? | ||
CollectionAssert.AreEquivalent(result.Select(r=>r.Settings), new[] { settings1,settings2}); | ||
CollectionAssert.AreEquivalent(result.Select(r => r.InputFilesRequiringGeneration), new[] { new string[0], new[]{"file2"}}); | ||
} | ||
} | ||
} |