-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
447679f
commit 77718ae
Showing
4 changed files
with
101 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
namespace CSharpPlus.Tests; | ||
|
||
#pragma warning disable S6605 | ||
#pragma warning disable S6602 | ||
|
||
public class CollectionExtensionsTests | ||
{ | ||
[Test] | ||
public void ShouldAddRange() | ||
{ | ||
List<int> currentItems = [1, 2, 3]; | ||
int[] newItems = [4, 5, 6]; | ||
int[] expected = [1, 2, 3, 4, 5, 6]; | ||
|
||
currentItems.AddRange(newItems); | ||
currentItems.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Test] | ||
public void ShouldRemoveRange() | ||
{ | ||
List<int> currentItems = [1, 2, 3, 4, 5, 6]; | ||
int[] expected = [1, 2, 3]; | ||
var removeRange = 3..6; | ||
|
||
currentItems.RemoveRange(removeRange); | ||
currentItems.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Test] | ||
public void ShouldRemoveRangeMid() | ||
{ | ||
List<int> currentItems = [1, 2, 3, 4, 5, 6]; | ||
int[] expected = [1, 6]; | ||
var removeRange = 1..^1; | ||
|
||
currentItems.RemoveRange(removeRange); | ||
currentItems.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Test] | ||
public void ShouldRemoveLast() | ||
{ | ||
List<int> currentItems = [1, 2, 3, 4]; | ||
int[] expected = [1, 2, 3]; | ||
|
||
currentItems.RemoveAt(^1); | ||
currentItems.Should().BeEquivalentTo(expected); | ||
} | ||
|
||
[Test] | ||
public void ShouldRemoveBeforeLast() | ||
{ | ||
List<int> currentItems = [1, 2, 3, 4]; | ||
int[] expected = [1, 2, 4]; | ||
|
||
currentItems.RemoveAt(^2); | ||
currentItems.Should().BeEquivalentTo(expected); | ||
} | ||
} |