/// <summary>
        /// Initializes a new instance of the <see cref="StoreTestReportDataCommands"/> class.
        /// </summary>
        /// <param name="fileSystem">The object that provides access to the file system.</param>
        /// <param name="configuration">The object that provides access to the application configuration.</param>
        /// <param name="activeTests">The object that stores information about all the active tests.</param>
        /// <param name="dataDownload">The function that handles the download of data from a remote endpoint.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        public StoreTestReportDataCommands(
            IFileSystem fileSystem,
            IConfiguration configuration,
            IStoreActiveTests activeTests,
            DownloadDataFromRemoteEndpoints dataDownload,
            SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => fileSystem);
                Lokad.Enforce.Argument(() => configuration);
                Lokad.Enforce.Argument(() => activeTests);
                Lokad.Enforce.Argument(() => dataDownload);
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_FileSystem = fileSystem;
            m_Configuration = configuration;
            m_ActiveTests = activeTests;
            m_DataDownload = dataDownload;
            m_Diagnostics = diagnostics;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestCycle"/> class.
        /// </summary>
        /// <param name="configuration">The object that provides access to the configuration options for the application.</param>
        /// <param name="testController">The object that handles test execution.</param>
        /// <param name="executingTests">The object that stores information about the test that are currently being executed.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="configuration"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="testController"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="executingTests"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public TestCycle(
            IConfiguration configuration,
            IControlTests testController,
            IStoreActiveTests executingTests,
            SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => configuration);
                Lokad.Enforce.Argument(() => testController);
                Lokad.Enforce.Argument(() => executingTests);
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_TestController = testController;
            m_Diagnostics = diagnostics;

            m_ExecutingTests = executingTests;

            m_CycleTimeInMilliSeconds = configuration.HasValueFor(MasterServiceConfigurationKeys.KeepAliveCycleTimeInMilliSeconds)
                ? configuration.Value<int>(MasterServiceConfigurationKeys.KeepAliveCycleTimeInMilliSeconds)
                : GlobalConstants.DefaultKeepAliveCycleTimeInMilliseconds;
            m_MaximumNumberOfCycleFailures = configuration.HasValueFor(MasterServiceConfigurationKeys.MaximumNumberOfCycleFailures)
                ? configuration.Value<int>(MasterServiceConfigurationKeys.MaximumNumberOfCycleFailures)
                : GlobalConstants.DefaultMaximumNumberOfCycleFailures;

            m_Timer.AutoReset = true;
            m_Timer.Interval = m_CycleTimeInMilliSeconds;
            m_Timer.Elapsed += TimerElapsed;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestController"/> class.
        /// </summary>
        /// <param name="configuration">The object that stores the configuration for the application.</param>
        /// <param name="executingTests">The object that stores the tests that are currently being executed.</param>
        /// <param name="testContextFactory">The object that creates a context which provides access to all test information.</param>
        /// <param name="activators">The collection of machine activators.</param>
        /// <param name="testSuitePackageFactory">The object that handles packing and unpacking test data.</param>
        /// <param name="fileSystem">The object that provides access to the file system.</param>
        /// <param name="reportBuilders">The function that is used to create a report.</param>
        /// <param name="sectionBuilders">The function that is used to create a test report section.</param>
        /// <param name="diagnostics">The object that provides the diagnostics methods for the application.</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="configuration"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="executingTests"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="testContextFactory"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="activators"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="testSuitePackageFactory"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="fileSystem"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="reportBuilders"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="sectionBuilders"/> is <see langword="null" />.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        ///     Thrown if <paramref name="diagnostics"/> is <see langword="null" />.
        /// </exception>
        public TestController(
            IConfiguration configuration,
            IStoreActiveTests executingTests,
            Func<Owned<IProvideTestingContext>> testContextFactory,
            IEnumerable<IEnvironmentActivator> activators,
            Func<ITestSuitePackage> testSuitePackageFactory,
            IFileSystem fileSystem,
            Func<IReportBuilder> reportBuilders,
            Func<string, IReportBuilder, ITestSectionBuilder> sectionBuilders,
            SystemDiagnostics diagnostics)
        {
            {
                Lokad.Enforce.Argument(() => configuration);
                Lokad.Enforce.Argument(() => testContextFactory);
                Lokad.Enforce.Argument(() => activators);
                Lokad.Enforce.Argument(() => testSuitePackageFactory);
                Lokad.Enforce.Argument(() => fileSystem);
                Lokad.Enforce.Argument(() => reportBuilders);
                Lokad.Enforce.Argument(() => sectionBuilders);
                Lokad.Enforce.Argument(() => diagnostics);
            }

            m_Configuration = configuration;
            m_TestContextFactory = testContextFactory;
            m_Activators = new List<IEnvironmentActivator>(activators);
            m_TestSuitePackageFactory = testSuitePackageFactory;
            m_FileSystem = fileSystem;
            m_ReportBuilders = reportBuilders;
            m_SectionBuilders = sectionBuilders;
            m_Diagnostics = diagnostics;

            m_ExecutingTests = executingTests;
            m_ExecutingTests.OnTestCompletion += HandleTestCompleted;
        }