/// <summary>
        /// Sends out a notification indicating that the test has completed.
        /// </summary>
        /// <param name="result">The test result.</param>
        /// <param name="report">The report describing the results of the test.</param>
        public override void OnTestCompleted(TestExecutionResult result, IReport report)
        {
            try
            {
                var htmlTransformer = new HtmlReportTransformer();
                htmlTransformer.Transform(report, CopyStream);
            }
            catch (Exception)
            {
                // Just continue with processing
            }

            try
            {
                var xmlTransformer = new XmlReportTransformer();
                xmlTransformer.Transform(report, CopyStream);
            }
            catch (Exception)
            {
                // Just continue with processing
            }
        }
        public void Transform()
        {
            var productName = "product";
            var productVersion = "1.2.3.4";
            var owner = "owner";
            var description = "description";
            var start = new DateTimeOffset(2000, 1, 1, 1, 1, 1, new TimeSpan(0, 0, 0));
            var end = start.AddSeconds(10);

            var name = "name";
            var section = new TestSection(
                "someName",
                start.AddSeconds(1),
                end.AddSeconds(-1),
                true,
                new List<DateBasedTestInformation>
                    {
                        new DateBasedTestInformation(start.AddSeconds(2), "info")
                    },
                new List<DateBasedTestInformation>
                    {
                        new DateBasedTestInformation(start.AddSeconds(3), "warning")
                    },
                new List<DateBasedTestInformation>
                    {
                        new DateBasedTestInformation(start.AddSeconds(4), "error")
                    });

            var report = BuildReport(productName, productVersion, owner, description, start, end, name, section);

            var outputNames = new List<string>();
            var outputs = new List<Stream>();
            Action<string, Stream> writer =
                (fileName, input) =>
                {
                    outputNames.Add(fileName);
                    outputs.Add(input);
                };

            var transformer = new HtmlReportTransformer();
            transformer.Transform(report, writer);

            var result = string.Empty;
            using (var reader = new StreamReader(outputs[0]))
            {
                result = reader.ReadToEnd().Replace("\r\n", string.Empty).Replace(" ", string.Empty);
            }

            var expected = EmbeddedResourceExtracter.LoadEmbeddedTextFile(
                Assembly.GetExecutingAssembly(),
                @"Sherlock.Shared.Core.Reporting.TestHtmlReport.html");

            var builder = new StringBuilder(expected);
            {
                builder.Replace("${DESCRIPTION}$", description);

                builder.Replace("${PRODUCT_NAME}$", productName);
                builder.Replace("${PRODUCT_VERSION}$", productVersion.ToString(CultureInfo.CurrentCulture));
                builder.Replace("${USER_NAME}$", owner);
                builder.Replace("${TEST_DESCRIPTION}$", description);
                builder.Replace("${TEST_START_DATE}$", start.ToString("d", CultureInfo.CurrentCulture));
                builder.Replace("${TEST_START_TIME}$", start.ToString("T", CultureInfo.CurrentCulture));
                builder.Replace("${TEST_END_DATE}$", end.ToString("d", CultureInfo.CurrentCulture));
                builder.Replace("${TEST_END_TIME}$", end.ToString("T", CultureInfo.CurrentCulture));
                builder.Replace("${TEST_TOTAL_TIME}$", (end - start).ToString("g", CultureInfo.CurrentCulture));

                builder.Replace("${SECTION_ICON}$", outputNames[3]);
                builder.Replace("${SECTION_CATEGORY}$", name);
                builder.Replace("${SECTION_DESCRIPTION}$", section.Name);

                builder.Replace("${INFO_ICON}$", outputNames[5]);
                builder.Replace("${INFO_TIME}$", section.InfoMessages().First().Time.ToString("G", CultureInfo.CurrentCulture));
                builder.Replace("${INFO_TEXT}$", section.InfoMessages().First().Information);

                builder.Replace("${WARNING_ICON}$", outputNames[6]);
                builder.Replace("${WARNING_TIME}$", section.WarningMessages().First().Time.ToString("G", CultureInfo.CurrentCulture));
                builder.Replace("${WARNING_TEXT}$", section.WarningMessages().First().Information);

                builder.Replace("${ERROR_ICON}$", outputNames[7]);
                builder.Replace("${ERROR_TIME}$", section.ErrorMessages().First().Time.ToString("G", CultureInfo.CurrentCulture));
                builder.Replace("${ERROR_TEXT}$", section.ErrorMessages().First().Information);

                builder.Replace("${HOST}$", Environment.MachineName);
                builder.Replace(
                    "${USERNAME}$",
                    string.Format(
                        CultureInfo.InvariantCulture,
                        @"{0}\{1}",
                        Environment.UserDomainName,
                        Environment.UserName));
                builder.Replace(
                    "${SHERLOCK_VERSION}$",
                    typeof(HtmlReportTransformer).Assembly.GetName().Version.ToString());
            }

            Assert.AreEqual(builder.ToString().Replace("\r\n", string.Empty).Replace(" ", string.Empty), result);
        }