@@ -2003,6 +2003,10 @@ public static IEnumerable<object[]> CustomResults
20032003 static Task < object > StaticTaskOfIResultAsObject ( ) => Task . FromResult < object > ( new CustomResult ( "Still not enough tests!" ) ) ;
20042004 static ValueTask < object > StaticValueTaskOfIResultAsObject ( ) => ValueTask . FromResult < object > ( new CustomResult ( "Still not enough tests!" ) ) ;
20052005
2006+ StructResult TestStructAction ( ) => new StructResult ( resultString ) ;
2007+ Task < StructResult > TaskTestStructAction ( ) => Task . FromResult ( new StructResult ( resultString ) ) ;
2008+ ValueTask < StructResult > ValueTaskTestStructAction ( ) => ValueTask . FromResult ( new StructResult ( resultString ) ) ;
2009+
20062010 return new List < object [ ] >
20072011 {
20082012 new object [ ] { ( Func < CustomResult > ) TestAction } ,
@@ -2021,6 +2025,10 @@ public static IEnumerable<object[]> CustomResults
20212025
20222026 new object [ ] { ( Func < Task < object > > ) StaticTaskOfIResultAsObject } ,
20232027 new object [ ] { ( Func < ValueTask < object > > ) StaticValueTaskOfIResultAsObject } ,
2028+
2029+ new object [ ] { ( Func < StructResult > ) TestStructAction } ,
2030+ new object [ ] { ( Func < Task < StructResult > > ) TaskTestStructAction } ,
2031+ new object [ ] { ( Func < ValueTask < StructResult > > ) ValueTaskTestStructAction } ,
20242032 } ;
20252033 }
20262034 }
@@ -3247,6 +3255,21 @@ public Task ExecuteAsync(HttpContext httpContext)
32473255 }
32483256 }
32493257
3258+ private struct StructResult : IResult
3259+ {
3260+ private readonly string _resultString ;
3261+
3262+ public StructResult ( string resultString )
3263+ {
3264+ _resultString = resultString ;
3265+ }
3266+
3267+ public Task ExecuteAsync ( HttpContext httpContext )
3268+ {
3269+ return httpContext . Response . WriteAsync ( _resultString ) ;
3270+ }
3271+ }
3272+
32503273 private class ExceptionThrowingRequestBodyStream : Stream
32513274 {
32523275 private readonly Exception _exceptionToThrow ;
0 commit comments