Skip to content

Commit

Permalink
Merge pull request #1411 from SimonCropp/use-some-range-indexors
Browse files Browse the repository at this point in the history
use some range indexors
  • Loading branch information
baywet authored Oct 6, 2023
2 parents 94c811e + efc7394 commit d3833c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Stream Load(Uri uri)
public Task<Stream> LoadAsync(Uri uri)
{
var path = new Uri(new("http://example.org/OpenApiReaderTests/Samples/OpenApiDiagnosticReportMerged/"), uri).AbsolutePath;
path = path.Substring(1); // remove leading slash
path = path[1..]; // remove leading slash
return Task.FromResult(Resources.GetStream(path));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public Stream Load(Uri uri)
public Task<Stream> LoadAsync(Uri uri)
{
var path = new Uri(new("http://example.org/V3Tests/Samples/OpenApiWorkspace/"), uri).AbsolutePath;
path = path.Substring(1); // remove leading slash
path = path[1..]; // remove leading slash
return Task.FromResult(Resources.GetStream(path));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ public void AttachPathWorks()
rootNode.Attach(path2, pathItem2, label2);

Assert.Equal(4, rootNode.Children.Count);
Assert.True(rootNode.Children.ContainsKey(path1.Substring(1)));
Assert.True(rootNode.Children.ContainsKey(path2.Substring(1)));
Assert.True(rootNode.Children[path1.Substring(1)].PathItems.ContainsKey(label1));
Assert.True(rootNode.Children[path2.Substring(1)].PathItems.ContainsKey(label2));
Assert.True(rootNode.Children.ContainsKey(path1[1..]));
Assert.True(rootNode.Children.ContainsKey(path2[1..]));
Assert.True(rootNode.Children[path1[1..]].PathItems.ContainsKey(label1));
Assert.True(rootNode.Children[path2[1..]].PathItems.ContainsKey(label2));
}

[Fact]
Expand Down

0 comments on commit d3833c4

Please sign in to comment.