|
1 | 1 | using System; |
2 | | -using System.Linq; |
3 | 2 | using Xunit; |
4 | 3 |
|
5 | 4 | public class SeriesTests |
6 | 5 | { |
7 | 6 | [Fact] |
8 | 7 | public void Slices_of_one_from_one() |
9 | 8 | { |
10 | | - var expected = new[] { "1" }; |
11 | | - Assert.Equal(expected, Series.Slices("1", 1).ToArray()); |
| 9 | + string[] expected = ["1"]; |
| 10 | + Assert.Equal(expected, Series.Slices("1", 1)); |
12 | 11 | } |
13 | 12 |
|
14 | 13 | [Fact(Skip = "Remove this Skip property to run this test")] |
15 | 14 | public void Slices_of_one_from_two() |
16 | 15 | { |
17 | | - var expected = new[] { "1", "2" }; |
18 | | - Assert.Equal(expected, Series.Slices("12", 1).ToArray()); |
| 16 | + string[] expected = ["1", "2"]; |
| 17 | + Assert.Equal(expected, Series.Slices("12", 1)); |
19 | 18 | } |
20 | 19 |
|
21 | 20 | [Fact(Skip = "Remove this Skip property to run this test")] |
22 | 21 | public void Slices_of_two() |
23 | 22 | { |
24 | | - var expected = new[] { "35" }; |
25 | | - Assert.Equal(expected, Series.Slices("35", 2).ToArray()); |
| 23 | + string[] expected = ["35"]; |
| 24 | + Assert.Equal(expected, Series.Slices("35", 2)); |
26 | 25 | } |
27 | 26 |
|
28 | 27 | [Fact(Skip = "Remove this Skip property to run this test")] |
29 | 28 | public void Slices_of_two_overlap() |
30 | 29 | { |
31 | | - var expected = new[] { "91", "14", "42" }; |
32 | | - Assert.Equal(expected, Series.Slices("9142", 2).ToArray()); |
| 30 | + string[] expected = ["91", "14", "42"]; |
| 31 | + Assert.Equal(expected, Series.Slices("9142", 2)); |
33 | 32 | } |
34 | 33 |
|
35 | 34 | [Fact(Skip = "Remove this Skip property to run this test")] |
36 | 35 | public void Slices_can_include_duplicates() |
37 | 36 | { |
38 | | - var expected = new[] { "777", "777", "777", "777" }; |
39 | | - Assert.Equal(expected, Series.Slices("777777", 3).ToArray()); |
| 37 | + string[] expected = ["777", "777", "777", "777"]; |
| 38 | + Assert.Equal(expected, Series.Slices("777777", 3)); |
40 | 39 | } |
41 | 40 |
|
42 | 41 | [Fact(Skip = "Remove this Skip property to run this test")] |
43 | 42 | public void Slices_of_a_long_series() |
44 | 43 | { |
45 | | - var expected = new[] { "91849", "18493", "84939", "49390", "93904", "39042", "90424", "04243" }; |
46 | | - Assert.Equal(expected, Series.Slices("918493904243", 5).ToArray()); |
| 44 | + string[] expected = ["91849", "18493", "84939", "49390", "93904", "39042", "90424", "04243"]; |
| 45 | + Assert.Equal(expected, Series.Slices("918493904243", 5)); |
47 | 46 | } |
48 | 47 |
|
49 | 48 | [Fact(Skip = "Remove this Skip property to run this test")] |
50 | 49 | public void Slice_length_is_too_large() |
51 | 50 | { |
52 | | - Assert.Throws<ArgumentException>(() => Series.Slices("12345", 6).ToArray()); |
| 51 | + Assert.Throws<ArgumentException>(() => Series.Slices("12345", 6)); |
53 | 52 | } |
54 | 53 |
|
55 | 54 | [Fact(Skip = "Remove this Skip property to run this test")] |
56 | 55 | public void Slice_length_is_way_too_large() |
57 | 56 | { |
58 | | - Assert.Throws<ArgumentException>(() => Series.Slices("12345", 42).ToArray()); |
| 57 | + Assert.Throws<ArgumentException>(() => Series.Slices("12345", 42)); |
59 | 58 | } |
60 | 59 |
|
61 | 60 | [Fact(Skip = "Remove this Skip property to run this test")] |
62 | 61 | public void Slice_length_cannot_be_zero() |
63 | 62 | { |
64 | | - Assert.Throws<ArgumentException>(() => Series.Slices("12345", 0).ToArray()); |
| 63 | + Assert.Throws<ArgumentException>(() => Series.Slices("12345", 0)); |
65 | 64 | } |
66 | 65 |
|
67 | 66 | [Fact(Skip = "Remove this Skip property to run this test")] |
68 | 67 | public void Slice_length_cannot_be_negative() |
69 | 68 | { |
70 | | - Assert.Throws<ArgumentException>(() => Series.Slices("123", -1).ToArray()); |
| 69 | + Assert.Throws<ArgumentException>(() => Series.Slices("123", -1)); |
71 | 70 | } |
72 | 71 |
|
73 | 72 | [Fact(Skip = "Remove this Skip property to run this test")] |
74 | 73 | public void Empty_series_is_invalid() |
75 | 74 | { |
76 | | - Assert.Throws<ArgumentException>(() => Series.Slices("", 1).ToArray()); |
| 75 | + Assert.Throws<ArgumentException>(() => Series.Slices("", 1)); |
77 | 76 | } |
78 | 77 | } |
0 commit comments