public async Task GeneratorController_Get_ReturnsZippedProject(string sourceUrl, string directory, string branch = null) { var client = new WebApplicationFactory <Startup>().CreateClient(); var metadata = new ProjectMetadata { ProjectName = "MyStarter", TemplateSourceType = "git", TemplateSourceUrl = sourceUrl, TemplateSourceDirectory = directory, TemplateSourceBranch = branch, Tags = new Dictionary <string, object> { { "projectName", "StarterApp" }, { "namespace", "My.StarterApp" }, { "ng", false }, { "react", true } }, FilesToExclude = "ClientApp{{ng}}/**" }; var response = await client.PostAsJsonAsync("/api/generator", metadata); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); var fileName = response.Content.Headers.ContentDisposition.FileName; var tempPath = Path.Combine(Path.GetTempPath(), nameof(DotInitializr), fileName); using (var fileStream = new FileStream(tempPath, FileMode.Create, FileAccess.Write, FileShare.None)) { await response.Content.CopyToAsync(fileStream); } File.Delete(tempPath); }