public void AddToSectionWithFinalizedReport() { var builder = new ReportBuilder(); builder.InitializeNewReport("product", "1.1", "user", "description"); builder.FinalizeReport(); Assert.Throws<CannotAddSectionToFinalizedReportException>(() => builder.AddToSection("bla", new List<TestSection>())); }
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 AddToSectionWithUninitializedReport() { var builder = new ReportBuilder(); Assert.Throws<CannotAddSectionToUninitializedReportException>(() => builder.AddToSection("bla", new List<TestSection>())); }
public void AddToSectionWithEmptyName() { var builder = new ReportBuilder(); Assert.Throws<ArgumentException>(() => builder.AddToSection(string.Empty, new List<TestSection>())); }