Skip to content

Commit d3833c4

Browse files
authored
Merge pull request #1411 from SimonCropp/use-some-range-indexors
use some range indexors
2 parents 94c811e + efc7394 commit d3833c4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Stream Load(Uri uri)
7171
public Task<Stream> LoadAsync(Uri uri)
7272
{
7373
var path = new Uri(new("http://example.org/OpenApiReaderTests/Samples/OpenApiDiagnosticReportMerged/"), uri).AbsolutePath;
74-
path = path.Substring(1); // remove leading slash
74+
path = path[1..]; // remove leading slash
7575
return Task.FromResult(Resources.GetStream(path));
7676
}
7777
}

test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public Stream Load(Uri uri)
108108
public Task<Stream> LoadAsync(Uri uri)
109109
{
110110
var path = new Uri(new("http://example.org/V3Tests/Samples/OpenApiWorkspace/"), uri).AbsolutePath;
111-
path = path.Substring(1); // remove leading slash
111+
path = path[1..]; // remove leading slash
112112
return Task.FromResult(Resources.GetStream(path));
113113
}
114114
}

test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ public void AttachPathWorks()
199199
rootNode.Attach(path2, pathItem2, label2);
200200

201201
Assert.Equal(4, rootNode.Children.Count);
202-
Assert.True(rootNode.Children.ContainsKey(path1.Substring(1)));
203-
Assert.True(rootNode.Children.ContainsKey(path2.Substring(1)));
204-
Assert.True(rootNode.Children[path1.Substring(1)].PathItems.ContainsKey(label1));
205-
Assert.True(rootNode.Children[path2.Substring(1)].PathItems.ContainsKey(label2));
202+
Assert.True(rootNode.Children.ContainsKey(path1[1..]));
203+
Assert.True(rootNode.Children.ContainsKey(path2[1..]));
204+
Assert.True(rootNode.Children[path1[1..]].PathItems.ContainsKey(label1));
205+
Assert.True(rootNode.Children[path2[1..]].PathItems.ContainsKey(label2));
206206
}
207207

208208
[Fact]

0 commit comments

Comments
 (0)