public string get_asset_Name(ContentPlanRequest request) { var plan = _contentPlanCache.PlanFor(request.Name); var description = new ContentPlanPreviewer(); plan.AcceptVisitor(description); var writer = new StringWriter(); description.Descriptions.Each(x => writer.WriteLine(x)); return writer.ToString(); }
public void AssertMatches(ContentPlan plan) { var previewer = new ContentPlanPreviewer(); plan.AcceptVisitor(previewer); try { previewer.Descriptions.ShouldHaveTheSameElementsAs(_expectations); } catch (Exception) { new ContentExpectationWriter(_expectations, previewer.Descriptions.ToList()).Write(); throw; } }
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); }