diff --git a/T4TS.Tests/Traversal/ProjectTraversalTests.cs b/T4TS.Tests/Traversal/ProjectTraversalTests.cs index cd1264f..d05eb46 100644 --- a/T4TS.Tests/Traversal/ProjectTraversalTests.cs +++ b/T4TS.Tests/Traversal/ProjectTraversalTests.cs @@ -6,6 +6,8 @@ using T4TS.Example.Models; using EnvDTE; using Moq; +using System.Collections.Generic; +using T4TS.Tests.Mocks; namespace T4TS.Tests.Traversal { @@ -15,24 +17,26 @@ public class ProjectTraversalTests [TestMethod] public void ShouldVisitEachNamespace() { - var proj = new Mocks.MockProjects(null, new Type[] + var proj = new Mocks.MockProjects(subProjectItems: null, types: new Type[] { typeof(LocalModel), typeof(ModelFromDifferentProject) }).Single(); - int callCount = 0; - var expectedNames = new string[] { "T4TS.Tests.Traversal.Models", "T4TS.Example.Models" }; + var expectedNames = new List { "T4TS.Tests.Traversal.Models", "T4TS.Example.Models" }; + var actualNames = new List(); - new ProjectTraverser(proj, (ns) => { Assert.AreEqual(expectedNames[callCount++], ns.Name); }); + new ProjectTraverser(proj, (ns) => { + actualNames.Add(ns.Name); + }); - Assert.AreEqual(2, callCount); + CollectionAssert.AreEqual(expectedNames, actualNames); } [TestMethod] public void ShouldVisitSubProjectItems() { - var subProjItem = new Mocks.MockProjectItems(null, new Type[] + var subProjItem = new MockProjectItems(subProjectItems: null, types: new Type[] { typeof(ModelFromDifferentProject) }).Single(); @@ -40,17 +44,19 @@ public void ShouldVisitSubProjectItems() var moqSubProjectItems = new Mock(); moqSubProjectItems.Setup(x => x.GetEnumerator()).Returns(() => new[] { subProjItem }.GetEnumerator()); - var proj = new Mocks.MockProjects(moqSubProjectItems.Object, new Type[] + var proj = new MockProjects(subProjectItems: moqSubProjectItems.Object, types: new Type[] { typeof(LocalModel) }).Single(); - int callCount = 0; - var expectedNames = new string[] { "T4TS.Tests.Traversal.Models", "T4TS.Example.Models" }; - - new ProjectTraverser(proj, (ns) => { Assert.AreEqual(expectedNames[callCount++], ns.Name); }); + var expectedNames = new List { "T4TS.Tests.Traversal.Models", "T4TS.Example.Models" }; + var actualNames = new List(); - Assert.AreEqual(2, callCount); + new ProjectTraverser(proj, (ns) => { + actualNames.Add(ns.Name); + }); + + CollectionAssert.AreEqual(expectedNames, actualNames); } } } \ No newline at end of file