private static ServiceBusWorkerProject CreateNew(
            ServiceBusEntity entity,
            TestConfig configuration,
            ServiceBusWorkerProjectOptions options,
            ITestOutputHelper outputWriter)
        {
            var project = new ServiceBusWorkerProject(entity, configuration, outputWriter);

            project.CreateNewProject(options);
            project.AddOrdersMessagePump();

            return(project);
        }
        /// <summary>
        /// Starts a newly created project from the ServiceBus Queue worker project template.
        /// </summary>
        /// <param name="config">The collection of configuration values to correctly initialize the resulting project with secret values.</param>
        /// <param name="options">The project options to manipulate the resulting structure of the project.</param>
        /// <param name="outputWriter">The output logger to add telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     A ServiceBus Queue project with a set of services to interact with the worker.
        /// </returns>
        public static async Task <ServiceBusWorkerProject> StartNewWithQueueAsync(
            TestConfig config,
            ServiceBusWorkerProjectOptions options,
            ITestOutputHelper outputWriter)
        {
            Guard.NotNull(config, nameof(config));
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(outputWriter, nameof(outputWriter));

            ServiceBusWorkerProject project = await StartNewAsync(ServiceBusEntity.Queue, config, options, outputWriter);

            return(project);
        }
        /// <summary>
        /// Starts a newly created project from the ServiceBus Queue or Topic worker project template.
        /// </summary>
        /// <param name="entity">The resource entity for which the worker template should be created, you can also use <see cref="StartNewWithQueueAsync(ITestOutputHelper)"/> or <see cref="StartNewWithTopicAsync(ITestOutputHelper)"/> instead.</param>
        /// <param name="configuration">The collection of configuration values to correctly initialize the resulting project with secret values.</param>
        /// <param name="options">The project options to manipulate the resulting structure of the project.</param>
        /// <param name="outputWriter">The output logger to add telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     A ServiceBus Queue project with a set of services to interact with the worker.
        /// </returns>
        public static async Task <ServiceBusWorkerProject> StartNewAsync(
            ServiceBusEntity entity,
            TestConfig configuration,
            ServiceBusWorkerProjectOptions options,
            ITestOutputHelper outputWriter)
        {
            ServiceBusWorkerProject project = CreateNew(entity, configuration, options, outputWriter);
            await project.StartAsync(options);

            await project.MessagePump.StartAsync();

            return(project);
        }