public void try_it_against_a_3_deep_hierarchy() { var theFiles = new AssetFile[] { new AssetFile("a.js") { FullPath = "a.js" }, new AssetFile("b.js") { FullPath = "b.js" }, new AssetFile("c.js") { FullPath = "c.js" }, new AssetFile("d.js") { FullPath = "d.js" }, }; var plan = new ContentPlan("something", theFiles); var read0 = plan.GetAllSources().ElementAt(0); var read1 = plan.GetAllSources().ElementAt(1); var read2 = plan.GetAllSources().ElementAt(2); var read3 = plan.GetAllSources().ElementAt(3); var combo1 = plan.Combine(new IContentSource[] { read1, read2 }); var combo2 = plan.Combine(new IContentSource[] { read0, combo1, read3 }); var previewer = new ContentPlanPreviewer(); plan.AcceptVisitor(previewer); previewer.WriteToDebug(); var expected = new StringBuilder() .AppendLine("Combination") .AppendLine(" FileRead:a.js") .AppendLine(" Combination") .AppendLine(" FileRead:b.js") .AppendLine(" FileRead:c.js") .Append(" FileRead:d.js"); previewer.ToFullDescription().ShouldEqual(expected); }
public void SetUp() { files = new AssetFile[] { new AssetFile("something.js") { FullPath = "something.js" }, new AssetFile("something2.js") { FullPath = "something2.js" }, new AssetFile("something3.js") { FullPath = "something3.js" }, new AssetFile("something4.js") { FullPath = "something4.js" }, }; thePlan = new ContentPlan("a plan", files); theCombination = thePlan.Combine(new[] { thePlan.GetAllSources().ElementAt(0), thePlan.GetAllSources().ElementAt(1) }); }
public void accept_a_visitor_simple() { var mocks = new MockRepository(); var visitor = mocks.StrictMock <IContentPlanVisitor>(); theFiles = new AssetFile[] { new AssetFile("a.js") { FullPath = "a.js" }, new AssetFile("b.js") { FullPath = "b.js" }, new AssetFile("c.js") { FullPath = "c.js" }, new AssetFile("d.js") { FullPath = "d.js" }, }; var plan = new ContentPlan("something", theFiles); var read0 = plan.GetAllSources().ElementAt(0); var read1 = plan.GetAllSources().ElementAt(1); var read2 = plan.GetAllSources().ElementAt(2); var read3 = plan.GetAllSources().ElementAt(3); var combo1 = plan.Combine(new IContentSource[] { read1, read2 }); var combo2 = plan.Combine(new IContentSource[] { read0, combo1, read3 }); using (mocks.Ordered()) { visitor.Expect(x => x.Push(combo2)); visitor.Expect(x => x.Push(read0)); visitor.Expect(x => x.Pop()); visitor.Expect(x => x.Push(combo1)); visitor.Expect(x => x.Push(read1)); visitor.Expect(x => x.Pop()); visitor.Expect(x => x.Push(read2)); visitor.Expect(x => x.Pop()); visitor.Expect(x => x.Pop()); visitor.Expect(x => x.Push(read3)); visitor.Expect(x => x.Pop()); visitor.Expect(x => x.Pop()); } mocks.ReplayAll(); plan.AcceptVisitor(visitor); mocks.VerifyAll(); }