Exemplo n.º 1
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="outputWriter">The output logger to add telemetry information during the creation and startup process.</param>
        /// <returns>
        ///     A Azure Functions HTTP project with a full set of endpoint services to interact with the Azure Function.
        /// </returns>
        /// <exception cref="CannotStartTemplateProjectException">Thrown when the Azure Functions project cannot be started correctly.</exception>
        public static async Task <AzureFunctionsHttpProject> StartNewAsync(TestConfig configuration, ITestOutputHelper outputWriter)
        {
            AzureFunctionsHttpProject project = CreateNew(configuration, outputWriter);
            await project.StartAsync();

            return(project);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts a newly created project from the Azure Functions HTTP project template.
        /// </summary>
        /// <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="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(ITestOutputHelper outputWriter)
        {
            Guard.NotNull(outputWriter, nameof(outputWriter), "Requires a test logger to write diagnostic information during the creation and startup process");

            AzureFunctionsHttpProject project = await StartNewAsync(new AzureFunctionsHttpProjectOptions(), outputWriter);

            return(project);
        }
Exemplo n.º 3
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="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"/> or <paramref name="outputWriter"/> is <c>null</c>.</exception>
        public static AzureFunctionsHttpProject CreateNew(TestConfig configuration, ITestOutputHelper outputWriter)
        {
            Guard.NotNull(configuration, nameof(configuration), "Requires a configuration instance to control the hosting of the to-be-created project");
            Guard.NotNull(outputWriter, nameof(outputWriter), "Requires a test logger to write diagnostic information during the creation and startup process");

            AzureFunctionsHttpProject project = CreateNew(configuration, new AzureFunctionsHttpProjectOptions(), outputWriter);

            return(project);
        }
Exemplo n.º 4
0
        private static AzureFunctionsHttpProject CreateNew(TestConfig configuration, ITestOutputHelper outputWriter)
        {
            var project = new AzureFunctionsHttpProject(configuration, outputWriter);

            project.CreateNewProject(new ProjectOptions());
            project.AddStorageAccount();

            return(project);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
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);
        }