/// <summary> /// Writes an OMPL representation of a test run's test results. /// </summary> /// <param name="testRun">The test run whose results you want to write to text.</param> /// <param name="capabilityNameClip">The part to remove from the beginning of each capability name.</param> /// <returns>String that is a OPML format of the test results.</returns> public static string WriteToOpml(this xBDD.Model.TestRun testRun, string capabilityNameClip = null) { ReportingFactory factory = new ReportingFactory(); OpmlWriter saver = factory.GetOpmlWriter(); return(saver.WriteToOpml(testRun, capabilityNameClip)); }
public void OpmlWriter_WithTwoBlogs_RendersCorrectIndentedOpml() { //arrange var blogs = new[] { new Blog { Id = 1, Host = "example.com", Subfolder = "blog1", Title = "example blog" }, new Blog { Id = 2, Host = "haacked.com", Title = "You've Been Haacked" } }; var writer = new StringWriter(); var urlHelper = new Mock <BlogUrlHelper>(); urlHelper.Setup(u => u.RssUrl(blogs[0])).Returns(new Uri("http://example.com/blog1/Rss.aspx")); urlHelper.Setup(u => u.RssUrl(blogs[1])).Returns(new Uri("http://haacked.com/Rss.aspx")); var opml = new OpmlWriter(); //act opml.Write(blogs, writer, urlHelper.Object); //assert const string expected = @"<opml version=""1.0""> <head> <title>A Subtext Community</title> </head> <body> <outline text=""A Subtext Community Feeds""> <outline type=""rss"" text=""example blog"" xmlUrl=""http://example.com/blog1/Rss.aspx"" /> <outline type=""rss"" text=""You've Been Haacked"" xmlUrl=""http://haacked.com/Rss.aspx"" /> </outline> </body> </opml>"; UnitTestHelper.AssertStringsEqualCharacterByCharacter(expected, writer.ToString()); Assert.AreEqual(expected, writer.ToString()); }