Beispiel #1
0
        /// <summary>
        /// Starts a newly created project from the Azure Functions HTTP project template.
        /// </summary>
        /// <param name="options">The project options to control the functionality of the to-be-created project from this template.</param>
        /// <param name="outputWriter">The output logger to write telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     An Azure Functions HTTP project with a full set of endpoint services to interact with.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="options"/>, or <paramref name="outputWriter"/> is <c>null</c>.</exception>
        /// <exception cref="CannotStartTemplateProjectException">Thrown when the Azure Functions project cannot be started correctly.</exception>
        public static async Task <AzureFunctionsHttpProject> StartNewAsync(
            AzureFunctionsHttpProjectOptions options,
            ITestOutputHelper outputWriter)
        {
            Guard.NotNull(options, nameof(options), "Requires a set of project argument options to create the Azure Functions HTTP trigger project");
            Guard.NotNull(outputWriter, nameof(outputWriter), "Requires a test logger to write diagnostic information during the creation and startup process");

            AzureFunctionsHttpProject project = await StartNewAsync(TestConfig.Create(), options, outputWriter);

            return(project);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new temporary project based on the Azure Functions HTTP trigger project template.
        /// </summary>
        /// <param name="configuration">The configuration to control the hosting of the to-be-created project.</param>
        /// <param name="options">The project options to control the functionality of the to-be-created project from this template.</param>
        /// <param name="outputWriter">The output logger to write telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     An Azure Functions HTTP trigger project with a full set of endpoint services to interact with.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when the <paramref name="configuration"/>, <paramref name="options"/> or <paramref name="outputWriter"/> is <c>null</c>.
        /// </exception>
        public static AzureFunctionsHttpProject CreateNew(TestConfig configuration, AzureFunctionsHttpProjectOptions options, ITestOutputHelper outputWriter)
        {
            Guard.NotNull(configuration, nameof(configuration), "Requires a configuration instance to control the hosting of the to-be-created project");
            Guard.NotNull(options, nameof(options), "Requires a set of project argument options to create the Azure Functions HTTP trigger project");
            Guard.NotNull(outputWriter, nameof(outputWriter), "Requires a test logger to write diagnostic information during the creation and startup process");

            var project = new AzureFunctionsHttpProject(configuration, outputWriter);

            project.CreateNewProject(options);
            project.AddStorageAccount();

            return(project);
        }
Beispiel #3
0
        /// <summary>
        /// Starts a newly created project from the Azure Functions HTTP project template.
        /// </summary>
        /// <param name="configuration">The configuration to control the hosting of the to-be-created project.</param>
        /// <param name="options">The project options to control the functionality of the to-be-created project from this template.</param>
        /// <param name="outputWriter">The output logger to write telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     An Azure Functions HTTP project with a full set of endpoint services to interact with.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when the <paramref name="configuration"/>, <paramref name="options"/>, or <paramref name="outputWriter"/> is <c>null</c>.
        /// </exception>
        /// <exception cref="CannotStartTemplateProjectException">Thrown when the Azure Functions project cannot be started correctly.</exception>
        public static async Task <AzureFunctionsHttpProject> StartNewAsync(
            TestConfig configuration,
            AzureFunctionsHttpProjectOptions options,
            ITestOutputHelper outputWriter)
        {
            Guard.NotNull(configuration, nameof(configuration), "Requires a configuration instance to control the hosting of the to-be-created project");
            Guard.NotNull(options, nameof(options), "Requires a set of project argument options to create the Azure Functions HTTP trigger project");
            Guard.NotNull(outputWriter, nameof(outputWriter), "Requires a test logger to write diagnostic information during the creation and startup process");

            AzureFunctionsHttpProject project = CreateNew(configuration, options, outputWriter);
            await project.StartAsync();

            return(project);
        }