|
2 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
3 | 3 |
|
4 | 4 | using System.IO; |
| 5 | +using System.Reflection; |
5 | 6 | using System.Threading; |
6 | 7 | using System.Threading.Tasks; |
7 | 8 | using Coverlet.Core.Samples.Tests; |
@@ -99,34 +100,35 @@ public void AsyncAwait_Issue_669_1() |
99 | 100 | } |
100 | 101 | } |
101 | 102 |
|
102 | | - //[Fact] |
103 | | - //public void AsyncAwait_Issue_669_2() |
104 | | - //{ |
105 | | - // string path = Path.GetTempFileName(); |
106 | | - // try |
107 | | - // { |
108 | | - // FunctionExecutor.Run(async (string[] pathSerialize) => |
109 | | - // { |
110 | | - // CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<Issue_669_2>(instance => |
111 | | - // { |
112 | | - // ((ValueTask<System.Net.Http.HttpResponseMessage>)instance.SendRequest()).ConfigureAwait(false).GetAwaiter().GetResult(); |
113 | | - // return Task.CompletedTask; |
114 | | - // }, |
115 | | - // persistPrepareResultToFile: pathSerialize[0]); |
116 | | - |
117 | | - // return 0; |
118 | | - // }, new string[] { path }); |
119 | | - |
120 | | - // TestInstrumentationHelper.GetCoverageResult(path) |
121 | | - // .Document("Instrumentation.AsyncAwait.cs") |
122 | | - // .AssertLinesCovered(BuildConfiguration.Debug, (7, 1), (10, 1), (11, 1), (12, 1), (13, 1), (15, 1)) |
123 | | - // .ExpectedTotalNumberOfBranches(BuildConfiguration.Debug, 0); |
124 | | - // } |
125 | | - // finally |
126 | | - // { |
127 | | - // File.Delete(path); |
128 | | - // } |
129 | | - //} |
| 103 | + [Fact] |
| 104 | + public void AsyncAwait_Issue_669_2() |
| 105 | + { |
| 106 | + string path = Path.GetTempFileName(); |
| 107 | + try |
| 108 | + { |
| 109 | + FunctionExecutor.Run(async (string[] pathSerialize) => |
| 110 | + { |
| 111 | + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run<Issue_669_2>(instance => |
| 112 | + { |
| 113 | + ((ValueTask<System.Net.Http.HttpResponseMessage>)instance.SendRequest()).ConfigureAwait(false).GetAwaiter().GetResult(); |
| 114 | + return Task.CompletedTask; |
| 115 | + }, |
| 116 | + persistPrepareResultToFile: pathSerialize[0], |
| 117 | + assemblyLocation: Assembly.GetExecutingAssembly().Location); |
| 118 | + |
| 119 | + return 0; |
| 120 | + }, new string[] { path }); |
| 121 | + |
| 122 | + TestInstrumentationHelper.GetCoverageResult(path) |
| 123 | + .Document("Instrumentation.AsyncAwait.cs") |
| 124 | + .AssertLinesCovered(BuildConfiguration.Debug, (7, 1), (10, 1), (11, 1), (12, 1), (13, 1), (15, 1)) |
| 125 | + .ExpectedTotalNumberOfBranches(BuildConfiguration.Debug, 0); |
| 126 | + } |
| 127 | + finally |
| 128 | + { |
| 129 | + File.Delete(path); |
| 130 | + } |
| 131 | + } |
130 | 132 |
|
131 | 133 | [Fact] |
132 | 134 | public void AsyncAwait_Issue_1177() |
|
0 commit comments