Example #1
0
        /// <summary>
        /// Begins reporting of a performance of a given type.
        /// </summary>
        /// <param name="performanceType">Performance type.</param>
        /// <param name="scenarioId">The screenplay scenario identity.</param>
        public void BeginPerformanceCategory(ReportableCategory performanceType,
                                             Guid scenarioId)
        {
            var scenario = GetScenarioBuilder(scenarioId);

            if (scenario.IsFinalised())
            {
                throw new ScenarioIsFinalisedAlreadyException(Resources.ExceptionFormats.ScenarioAlreadyFinalised);
            }

            scenario.BeginPerformanceCategory(performanceType);
        }
        string GetPerformanceTypeString(ReportableCategory type, int currentIndentLevel)
        {
            if (!type.IsDefinedValue() || type == ReportableCategory.None)
            {
                return(String.Empty);
            }

            // Don't keep writing the performance type after the base indent level
            if (currentIndentLevel > 0)
            {
                return(String.Empty);
            }

            return(type.ToString());
        }
Example #3
0
        public void BeginPerformanceType_calls_BeginPerformanceType_from_builder(IBuildsScenario scenarioBuilder,
                                                                                 IFormatsObjectForReport formatter,
                                                                                 Builders.IGetsReport reportFactory,
                                                                                 Guid scenarioIdentity,
                                                                                 ReportableCategory category)
        {
            // Arrange
            var sut = new ReportBuilder(formatter, reportFactory, GetScenarioBuilderFactory(scenarioBuilder));

            sut.BeginNewScenario(null, null, null, null, scenarioIdentity, false, false);

            // Act
            sut.BeginPerformanceCategory(category, scenarioIdentity);

            // Assert
            Mock.Get(scenarioBuilder).Verify(x => x.BeginPerformanceCategory(category), Times.Once);
        }
Example #4
0
        public void BeginPerformanceType_raises_exception_when_called_after_EndScenario(ReportableCategory type,
                                                                                        bool success,
                                                                                        ReportBuilder sut,
                                                                                        Guid scenarioIdentity)
        {
            // Arrange
            sut.BeginNewScenario(null, null, null, null, scenarioIdentity, false, false);
            sut.EndScenario(success, scenarioIdentity);

            // Act & assert
            Assert.That(() => sut.BeginPerformanceCategory(type, scenarioIdentity),
                        Throws.TypeOf <ScenarioIsFinalisedAlreadyException>());
        }
Example #5
0
 public void BeginPerformanceType_raises_exception_when_called_for_a_scenario_which_has_not_begun(ReportBuilder sut,
                                                                                                  ReportableCategory category,
                                                                                                  Guid scenarioIdentity)
 {
     // Act & assert
     Assert.That(() => sut.BeginPerformanceCategory(category, scenarioIdentity),
                 Throws.TypeOf <ScenarioHasNotBegunException>());
 }
 /// <summary>
 /// Ends the performance of the current type.
 /// </summary>
 public void EndPerformanceCategory()
 {
     EnsureNotFinalised();
     currentPerformanceType = ReportableCategory.None;
 }
 /// <summary>
 /// Begins reporting of a performance of a given type.
 /// </summary>
 /// <param name="performanceType">Performance type.</param>
 public void BeginPerformanceCategory(ReportableCategory performanceType)
 {
     EnsureNotFinalised();
     performanceType.RequireDefinedValue(nameof(performanceType));
     currentPerformanceType = performanceType;
 }