public void Build() { var builder = new ReportBuilder(); var product = "product"; var version = "1.2.3.4"; var user = "******"; var description = "description"; builder.InitializeNewReport(product, version, user, description); var name = "name"; var sections = new List<TestSection> { new TestSection( "someName", DateTimeOffset.Now, DateTimeOffset.Now, true, new List<DateBasedTestInformation>(), new List<DateBasedTestInformation>(), new List<DateBasedTestInformation>()) }; builder.AddToSection(name, sections); builder.FinalizeReport(); var report = builder.Build(); Assert.AreEqual(product, report.Header.ProductName); Assert.AreEqual(version, report.Header.ProductVersion); Assert.AreEqual(user, report.Header.UserName); Assert.AreEqual(description, report.Header.Description); Assert.AreEqual(1, report.Sections().Count()); Assert.That( report.Sections().First().Sections(), Is.EquivalentTo(sections)); }
public void BuildWithNonInitializedReport() { var builder = new ReportBuilder(); Assert.Throws<CannotBuildAnUninitializedReportException>(() => builder.Build()); }
public void BuildWithNonFinalizedReport() { var builder = new ReportBuilder(); builder.InitializeNewReport("product", "1.1", "user", "description"); Assert.Throws<CannotBuildNonFinalizedReportException>(() => builder.Build()); }