public void SetUp() { // Project dependency graph // // Project2 // / //Project0 Project5 // \ / // Project6 // \ //Project1 Project4 // \ / // Project3 // _projectList = new string[] { string.Format("Proj0{0}Project0.csproj", Path.DirectorySeparatorChar), string.Format("Proj1{0}Project1.csproj", Path.DirectorySeparatorChar), string.Format("Proj2{0}Project2.csproj", Path.DirectorySeparatorChar), string.Format("Proj3{0}Project3.csproj", Path.DirectorySeparatorChar), string.Format("Proj4{0}Project4.csproj", Path.DirectorySeparatorChar), string.Format("Proj5{0}Project5.csproj", Path.DirectorySeparatorChar), string.Format("Proj6{0}Project6.csproj", Path.DirectorySeparatorChar) }; _cache = MockRepository.GenerateMock <ICache>(); var document = new ProjectDocument(ProjectType.CSharp); document.AddReferencedBy(new string[] { _projectList[2], _projectList[6] }); document.SetAssemblyName("Project0.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); _cache.Stub(c => c.Get <Project>(_projectList[0])).Return(new Project(_projectList[0], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReferencedBy(_projectList[3]); document.SetAssemblyName("Project1.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); document.RebuildOnNextRun(); _cache.Stub(c => c.Get <Project>(_projectList[1])).Return(new Project(_projectList[1], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReference(_projectList[0]); document.SetAssemblyName("Project2.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); _cache.Stub(c => c.Get <Project>(_projectList[2])).Return(new Project(_projectList[2], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReference(_projectList[1]); document.AddReferencedBy(_projectList[4]); document.SetAssemblyName("Project3.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); _cache.Stub(c => c.Get <Project>(_projectList[3])).Return(new Project(_projectList[3], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReference(new string[] { _projectList[6], _projectList[3] }); document.SetAssemblyName("Project4.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); _cache.Stub(c => c.Get <Project>(_projectList[4])).Return(new Project(_projectList[4], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReference(_projectList[6]); document.SetAssemblyName("Project5.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); document.RebuildOnNextRun(); _cache.Stub(c => c.Get <Project>(_projectList[5])).Return(new Project(_projectList[5], document)); document = new ProjectDocument(ProjectType.CSharp); document.AddReference(_projectList[0]); document.AddReferencedBy(new string[] { _projectList[4], _projectList[5] }); document.SetAssemblyName("Project6.dll"); document.SetOutputPath(string.Format("bin{0}Debug", Path.DirectorySeparatorChar)); _cache.Stub(c => c.Get <Project>(_projectList[6])).Return(new Project(_projectList[6], document)); _optimizer = new BuildOptimizer(_cache, MockRepository.GenerateMock <IConfiguration>()); }