public void AddWarningMessageWithEmptyText()
        {
            var builder = new TestSectionBuilder("section", (s, t) => { });
             builder.Initialize("someName");

             Assert.Throws<ArgumentException>(() => builder.AddWarningMessage(string.Empty));
        }
        public void FinalizeAndStore()
        {
            var outputSectionName = string.Empty;
             TestSection result = null;
             Action<string, TestSection> onBuild =
            (s, t) =>
            {
               outputSectionName = s;
               result = t;
            };

             var sectionName = "section";
             var testSectionName = "someTest";
             var builder = new TestSectionBuilder(sectionName, onBuild);
             builder.Initialize(testSectionName);

             var information = "information";
             builder.AddInformationMessage(information);

             var warning = "warning";
             builder.AddWarningMessage(warning);

             var error = "error";
             builder.AddErrorMessage(error);

             builder.FinalizeAndStore(true);

             Assert.AreSame(sectionName, outputSectionName);
             Assert.AreSame(testSectionName, result.Name);
             Assert.IsTrue(result.WasSuccessful);
             Assert.AreSame(information, result.InfoMessages().First().Information);
             Assert.AreSame(warning, result.WarningMessages().First().Information);
             Assert.AreSame(error, result.ErrorMessages().First().Information);
        }
 public void AddWarningMessageWithNonInitializedBuilder()
 {
     var builder = new TestSectionBuilder("section", (s, t) => { });
      Assert.Throws<CannotAddMessageToUninitializedTestSectionException>(() => builder.AddWarningMessage("SomeText"));
 }
 public void InitializeWithEmptyName()
 {
     var builder = new TestSectionBuilder("section", (s, t) => { });
      Assert.Throws<ArgumentException>(() => builder.Initialize(string.Empty));
 }
 public void FinalizeAndStoreWithUninitializedBuilder()
 {
     var builder = new TestSectionBuilder("section", (s, t) => { });
      Assert.Throws<CannotFinalizeAnUninitializedTestSectionException>(() => builder.FinalizeAndStore(false));
 }