128 references to WriteIndentedLine
ResultsOfTGenerator (128)
Program.cs (128)
128writer.WriteIndentedLine(2, "Result = activeResult;"); 143writer.WriteIndentedLine(2, "ArgumentNullException.ThrowIfNull(httpContext);"); 145writer.WriteIndentedLine(2, "if (Result is null)"); 146writer.WriteIndentedLine(2, "{"); 147writer.WriteIndentedLine(3, "throw new InvalidOperationException(\"The IResult assigned to the Result property must not be null.\");"); 148writer.WriteIndentedLine(2, "}"); 150writer.WriteIndentedLine(2, "return Result.ExecuteAsync(httpContext);"); 185writer.WriteIndentedLine(2, "ArgumentNullException.ThrowIfNull(method);"); 186writer.WriteIndentedLine(2, "ArgumentNullException.ThrowIfNull(builder);"); 190writer.WriteIndentedLine(2, $"ResultsOfTHelper.PopulateMetadataIfTargetIsIEndpointMetadataProvider<TResult{j}>(method, builder);"); 346writer.WriteIndentedLine(2, "// Arrange"); 357writer.WriteIndentedLine(2, "{"); 358writer.WriteIndentedLine(3, "return id switch"); 359writer.WriteIndentedLine(3, "{"); 364writer.WriteIndentedLine(4, $"{j} => new ChecksumResult{j}(),"); 368writer.WriteIndentedLine(4, $"_ => new ChecksumResult{j}()"); 371writer.WriteIndentedLine(3, "};"); 372writer.WriteIndentedLine(2, "}"); 376writer.WriteIndentedLine(2, "// Act"); 377writer.WriteIndentedLine(2, "var result = MyApi(input);"); 381writer.WriteIndentedLine(2, "// Assert"); 382writer.WriteIndentedLine(2, "Assert.IsType(expectedResultType, result.Result);"); 437writer.WriteIndentedLine(2, "// Arrange"); 448writer.WriteIndentedLine(2, "{"); 449writer.WriteIndentedLine(3, "return checksum switch"); 450writer.WriteIndentedLine(3, "{"); 455writer.WriteIndentedLine(4, $"{j} => new ChecksumResult{j}(checksum),"); 459writer.WriteIndentedLine(4, $"_ => new ChecksumResult{j}(checksum)"); 462writer.WriteIndentedLine(3, "};"); 463writer.WriteIndentedLine(2, "}"); 464writer.WriteIndentedLine(2, "var httpContext = GetHttpContext();"); 468writer.WriteIndentedLine(2, "// Act"); 469writer.WriteIndentedLine(2, "var result = MyApi(input);"); 470writer.WriteIndentedLine(2, "await result.ExecuteAsync(httpContext);"); 474writer.WriteIndentedLine(2, "// Assert"); 475writer.WriteIndentedLine(2, "Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]);"); 516writer.WriteIndentedLine(2, "// Arrange"); 517writer.WriteIndentedLine(2, "Results<ChecksumResult1, NoContent> MyApi()"); 518writer.WriteIndentedLine(2, "{"); 519writer.WriteIndentedLine(3, "return new ChecksumResult1(1);"); 520writer.WriteIndentedLine(2, "}"); 521writer.WriteIndentedLine(2, "HttpContext httpContext = null;"); 525writer.WriteIndentedLine(2, "// Act & Assert"); 526writer.WriteIndentedLine(2, "var result = MyApi();"); 529writer.WriteIndentedLine(2, "await Assert.ThrowsAsync<ArgumentNullException>(async () =>"); 530writer.WriteIndentedLine(2, "{"); 531writer.WriteIndentedLine(3, "await result.ExecuteAsync(httpContext);"); 532writer.WriteIndentedLine(2, "});"); 535writer.WriteIndentedLine(1, "}"); 573writer.WriteIndentedLine(2, "// Arrange"); 574writer.WriteIndentedLine(2, "Results<ChecksumResult1, NoContent> MyApi()"); 575writer.WriteIndentedLine(2, "{"); 576writer.WriteIndentedLine(3, "return (ChecksumResult1)null;"); 577writer.WriteIndentedLine(2, "}"); 578writer.WriteIndentedLine(2, "var httpContext = GetHttpContext();"); 582writer.WriteIndentedLine(2, "// Act & Assert"); 583writer.WriteIndentedLine(2, "var result = MyApi();"); 586writer.WriteIndentedLine(2, "await Assert.ThrowsAsync<InvalidOperationException>(async () =>"); 587writer.WriteIndentedLine(2, "{"); 588writer.WriteIndentedLine(3, "await result.ExecuteAsync(httpContext);"); 589writer.WriteIndentedLine(2, "});"); 592writer.WriteIndentedLine(1, "}"); 650writer.WriteIndentedLine(2, "// Arrange"); 669writer.WriteIndentedLine(2, "{"); 670writer.WriteIndentedLine(3, "return id switch"); 671writer.WriteIndentedLine(3, "{"); 676writer.WriteIndentedLine(4, $"{j} => new ChecksumResult{j}({j}),"); 680writer.WriteIndentedLine(4, $"_ => new ChecksumResult{j}({j})"); 683writer.WriteIndentedLine(3, "};"); 684writer.WriteIndentedLine(2, "}"); 685writer.WriteIndentedLine(2, "var httpContext = GetHttpContext();"); 689writer.WriteIndentedLine(2, "// Act"); 690writer.WriteIndentedLine(2, "var result = MyApi(input);"); 691writer.WriteIndentedLine(2, "await result.ExecuteAsync(httpContext);"); 695writer.WriteIndentedLine(2, "// Assert"); 696writer.WriteIndentedLine(2, "Assert.IsType(expectedResultType, result.Result);"); 697writer.WriteIndentedLine(2, "Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]);"); 700writer.WriteIndentedLine(1, "}"); 780writer.WriteIndentedLine(2, "// Arrange"); 783writer.WriteIndentedLine(2, "{"); 784writer.WriteIndentedLine(3, "return id switch"); 785writer.WriteIndentedLine(3, "{"); 788writer.WriteIndentedLine(4, $"{j} => ({nestedResultTypeName})new ChecksumResult{j}({j}),"); 790writer.WriteIndentedLine(4, $"_ => new ChecksumResult{typeArgCount + 1}({typeArgCount + 1})"); 791writer.WriteIndentedLine(3, "};"); 792writer.WriteIndentedLine(2, "}"); 793writer.WriteIndentedLine(2, "var httpContext = GetHttpContext();"); 797writer.WriteIndentedLine(2, "// Act"); 798writer.WriteIndentedLine(2, "var result = MyApi(input);"); 799writer.WriteIndentedLine(2, "await result.ExecuteAsync(httpContext);"); 803writer.WriteIndentedLine(2, "// Assert"); 804writer.WriteIndentedLine(2, "Assert.IsType(expectedResultType, result.Result);"); 805writer.WriteIndentedLine(2, "Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]);"); 808writer.WriteIndentedLine(1, "}"); 842writer.WriteIndentedLine(2, "// Arrange"); 854writer.WriteIndentedLine(2, @"var builder = new RouteEndpointBuilder(requestDelegate: null, RoutePatternFactory.Parse(""/""), order: 0);"); 858writer.WriteIndentedLine(2, "// Act"); 873writer.WriteIndentedLine(2, "// Assert"); 876writer.WriteIndentedLine(2, $"Assert.Contains(builder.Metadata, m => m is ResultTypeProvidedMetadata {{ SourceTypeName: nameof(ProvidesMetadataResult{j}) }});"); 880writer.WriteIndentedLine(1, "}"); 907writer.WriteIndentedLine(2, "// Act & Assert"); 933writer.WriteIndentedLine(1, "}"); 941writer.WriteIndentedLine(1, "abstract class ChecksumResult : IResult"); 942writer.WriteIndentedLine(1, "{"); 943writer.WriteIndentedLine(2, "public ChecksumResult(int checksum = 0)"); 944writer.WriteIndentedLine(2, "{"); 945writer.WriteIndentedLine(3, "Checksum = checksum;"); 946writer.WriteIndentedLine(2, "}"); 948writer.WriteIndentedLine(2, "public int Checksum { get; }"); 950writer.WriteIndentedLine(2, "public Task ExecuteAsync(HttpContext httpContext)"); 951writer.WriteIndentedLine(2, "{"); 952writer.WriteIndentedLine(3, "httpContext.Items[nameof(ChecksumResult.Checksum)] = Checksum;"); 953writer.WriteIndentedLine(3, "return Task.CompletedTask;"); 954writer.WriteIndentedLine(2, "}"); 955writer.WriteIndentedLine(1, "}"); 964writer.WriteIndentedLine(1, $"class ChecksumResult{typeArgNumber} : ChecksumResult"); 965writer.WriteIndentedLine(1, "{"); 966writer.WriteIndentedLine(2, $"public ChecksumResult{typeArgNumber}(int checksum = 0) : base(checksum) {{ }}"); 967writer.WriteIndentedLine(1, "}"); 982writer.WriteIndentedLine(1, $"class ProvidesMetadataResult{typeArgNumber} : IResult, IEndpointMetadataProvider"); 983writer.WriteIndentedLine(1, "{"); 984writer.WriteIndentedLine(2, "public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;"); 986writer.WriteIndentedLine(2, "public static void PopulateMetadata(MethodInfo method, EndpointBuilder builder)"); 987writer.WriteIndentedLine(2, "{"); 988writer.WriteIndentedLine(3, $"builder.Metadata.Add(new ResultTypeProvidedMetadata {{ SourceTypeName = nameof(ProvidesMetadataResult{typeArgNumber}) }});"); 989writer.WriteIndentedLine(2, "}"); 990writer.WriteIndentedLine(1, "}"); 1015WriteIndentedLine(writer, 1, value);