Skip to content

Commit 7a18bd6

Browse files
[Refactor] to use token.ThrowIfCancellationRequested() directly
1 parent f3e9d14 commit 7a18bd6

35 files changed

Lines changed: 86 additions & 324 deletions

ReqIFSharp.Tests/ReqIFContentTestFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public async Task ReadXmlAsync_UnsupportedElement_EmitsLogWarning()
109109
}
110110

111111
[Test]
112-
public async Task VErify_that_when_cancelled_ReadXmlAsync_throws_exception()
112+
public async Task Verify_that_when_cancelled_ReadXmlAsync_throws_exception()
113113
{
114114
var xml = """
115115
<REQ-IF-CONTENT />

ReqIFSharp.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{
2424
ProjectSection(SolutionItems) = preProject
2525
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
2626
.github\workflows\CodeQuality.yml = .github\workflows\CodeQuality.yml
27+
.github\workflows\nuget-reference-check.yml = .github\workflows\nuget-reference-check.yml
28+
.github\workflows\release.yml = .github\workflows\release.yml
2729
EndProjectSection
2830
EndProject
2931
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReqIFSharp.Extensions", "ReqIFSharp.Extensions\ReqIFSharp.Extensions.csproj", "{93D5132D-F20B-480A-930B-637996AF0E07}"

ReqIFSharp/AlternativeID.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ internal void WriteXml(XmlWriter writer)
8989
/// </param>
9090
internal async Task WriteXmlAsync(XmlWriter writer, CancellationToken token)
9191
{
92-
if (token.IsCancellationRequested)
93-
{
94-
token.ThrowIfCancellationRequested();
95-
}
92+
token.ThrowIfCancellationRequested();
9693

9794
await writer.WriteStartElementAsync(null, "ALTERNATIVE-ID", null);
9895
await writer.WriteAttributeStringAsync(null, "IDENTIFIER", null, this.Identifier);

ReqIFSharp/AttributeDefinition/AttributeDefinitionBoolean.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
186186

187187
while (await reader.ReadAsync())
188188
{
189-
if (token.IsCancellationRequested)
190-
{
191-
token.ThrowIfCancellationRequested();
192-
}
189+
token.ThrowIfCancellationRequested();
193190

194191
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
195192
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionDate.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
186186

187187
while (await reader.ReadAsync())
188188
{
189-
if (token.IsCancellationRequested)
190-
{
191-
token.ThrowIfCancellationRequested();
192-
}
189+
token.ThrowIfCancellationRequested();
193190

194191
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
195192
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionEnumeration.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
203203

204204
while (await reader.ReadAsync())
205205
{
206-
if (token.IsCancellationRequested)
207-
{
208-
token.ThrowIfCancellationRequested();
209-
}
206+
token.ThrowIfCancellationRequested();
210207

211208
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
212209
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionInteger.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
188188

189189
while (await reader.ReadAsync())
190190
{
191-
if (token.IsCancellationRequested)
192-
{
193-
token.ThrowIfCancellationRequested();
194-
}
191+
token.ThrowIfCancellationRequested();
195192

196193
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
197194
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionReal.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
187187

188188
while (await reader.ReadAsync())
189189
{
190-
if (token.IsCancellationRequested)
191-
{
192-
token.ThrowIfCancellationRequested();
193-
}
190+
token.ThrowIfCancellationRequested();
194191

195192
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
196193
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionString.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
186186

187187
while (await reader.ReadAsync())
188188
{
189-
if (token.IsCancellationRequested)
190-
{
191-
token.ThrowIfCancellationRequested();
192-
}
189+
token.ThrowIfCancellationRequested();
193190

194191
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
195192
{

ReqIFSharp/AttributeDefinition/AttributeDefinitionXHTML.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ internal override async Task ReadXmlAsync(XmlReader reader, CancellationToken to
186186

187187
while (await reader.ReadAsync())
188188
{
189-
if (token.IsCancellationRequested)
190-
{
191-
token.ThrowIfCancellationRequested();
192-
}
189+
token.ThrowIfCancellationRequested();
193190

194191
if (await reader.MoveToContentAsync() == XmlNodeType.Element)
195192
{

0 commit comments

Comments
 (0)