Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs')
-rw-r--r--src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs141
1 files changed, 70 insertions, 71 deletions
diff --git a/src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs b/src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs
index bec41c3f05..92736dd515 100644
--- a/src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs
+++ b/src/Http/Routing/test/UnitTests/Matching/MultipleEntryJumpTableTest.cs
@@ -3,78 +3,77 @@
using Xunit;
-namespace Microsoft.AspNetCore.Routing.Matching
+namespace Microsoft.AspNetCore.Routing.Matching;
+
+public abstract class MultipleEntryJumpTableTest
{
- public abstract class MultipleEntryJumpTableTest
+ internal abstract JumpTable CreateTable(
+ int defaultDestination,
+ int exitDestination,
+ params (string text, int destination)[] entries);
+
+ [Fact]
+ public void GetDestination_ZeroLengthSegment_JumpsToExit()
+ {
+ // Arrange
+ var table = CreateTable(0, 1, ("text", 2));
+
+ // Act
+ var result = table.GetDestination("ignored", new PathSegment(0, 0));
+
+ // Assert
+ Assert.Equal(1, result);
+ }
+
+ [Fact]
+ public void GetDestination_NonMatchingSegment_JumpsToDefault()
+ {
+ // Arrange
+ var table = CreateTable(0, 1, ("text", 2));
+
+ // Act
+ var result = table.GetDestination("text", new PathSegment(1, 2));
+
+ // Assert
+ Assert.Equal(0, result);
+ }
+
+ [Fact]
+ public void GetDestination_SegmentMatchingText_JumpsToDestination()
{
- internal abstract JumpTable CreateTable(
- int defaultDestination,
- int exitDestination,
- params (string text, int destination)[] entries);
-
- [Fact]
- public void GetDestination_ZeroLengthSegment_JumpsToExit()
- {
- // Arrange
- var table = CreateTable(0, 1, ("text", 2));
-
- // Act
- var result = table.GetDestination("ignored", new PathSegment(0, 0));
-
- // Assert
- Assert.Equal(1, result);
- }
-
- [Fact]
- public void GetDestination_NonMatchingSegment_JumpsToDefault()
- {
- // Arrange
- var table = CreateTable(0, 1, ("text", 2));
-
- // Act
- var result = table.GetDestination("text", new PathSegment(1, 2));
-
- // Assert
- Assert.Equal(0, result);
- }
-
- [Fact]
- public void GetDestination_SegmentMatchingText_JumpsToDestination()
- {
- // Arrange
- var table = CreateTable(0, 1, ("text", 2));
-
- // Act
- var result = table.GetDestination("some-text", new PathSegment(5, 4));
-
- // Assert
- Assert.Equal(2, result);
- }
-
- [Fact]
- public void GetDestination_SegmentMatchingTextIgnoreCase_JumpsToDestination()
- {
- // Arrange
- var table = CreateTable(0, 1, ("text", 2));
-
- // Act
- var result = table.GetDestination("some-tExt", new PathSegment(5, 4));
-
- // Assert
- Assert.Equal(2, result);
- }
-
- [Fact]
- public void GetDestination_SegmentMatchingTextIgnoreCase_MultipleEntries()
- {
- // Arrange
- var table = CreateTable(0, 1, ("tezt", 2), ("text", 3));
-
- // Act
- var result = table.GetDestination("some-tExt", new PathSegment(5, 4));
-
- // Assert
- Assert.Equal(3, result);
- }
+ // Arrange
+ var table = CreateTable(0, 1, ("text", 2));
+
+ // Act
+ var result = table.GetDestination("some-text", new PathSegment(5, 4));
+
+ // Assert
+ Assert.Equal(2, result);
+ }
+
+ [Fact]
+ public void GetDestination_SegmentMatchingTextIgnoreCase_JumpsToDestination()
+ {
+ // Arrange
+ var table = CreateTable(0, 1, ("text", 2));
+
+ // Act
+ var result = table.GetDestination("some-tExt", new PathSegment(5, 4));
+
+ // Assert
+ Assert.Equal(2, result);
+ }
+
+ [Fact]
+ public void GetDestination_SegmentMatchingTextIgnoreCase_MultipleEntries()
+ {
+ // Arrange
+ var table = CreateTable(0, 1, ("tezt", 2), ("text", 3));
+
+ // Act
+ var result = table.GetDestination("some-tExt", new PathSegment(5, 4));
+
+ // Assert
+ Assert.Equal(3, result);
}
}