Exemplo n.º 1
0
        public void LetsTalkAboutCastleWindsor()
        {
            var workingPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(workingPath);

            var nuget       = GetNuGet("Castle.Windsor", "4.0.0");
            var nugetStream = new MemoryStream();

            nugetStream.Write(nuget, 0, nuget.Length);
            var a = new ZipArchive(nugetStream);

            foreach (var file in a.Entries)
            {
                if (file.FullName == "lib/net45/Castle.Windsor.dll")
                {
                    file.ExtractToFile(Path.Combine(workingPath, file.Name), false);
                }

                if (file.FullName == "lib/net45/Castle.Windsor.xml")
                {
                    file.ExtractToFile(Path.Combine(workingPath, file.Name), false);
                }
            }

            var formatter     = new CSharpFormatter();
            var generatedHtml = formatter.GetHtmlForMarkdownContent(@"

# Let's talk about Castle Windsor

There is this IFacility inferface:

    #r ""Castle.Windsor.dll""
    var t = typeof(Castle.MicroKernel.IFacility);

    var container = new Castle.Windsor.WindsorContainer();
    container.Resolve<string>();

", baseReferencePath: workingPath);

            Assert.True(generatedHtml.Contains("Unit of extension. A facility should use the extension points offered by the kernel to augment its functionality."));
            Assert.True(generatedHtml.Contains("Returns a component instance by the service"));
        }