@@ -17,14 +17,14 @@ public void Can_SplitOnFirst_char_needle()
17
17
}
18
18
19
19
[ Test ]
20
- public void Can_GetLeftPart_and_GetLeftPart_char_needle ( )
20
+ public void Can_LeftPart_and_LeftPart_char_needle ( )
21
21
{
22
22
var str = "user:pass@w:rd" ;
23
- Assert . That ( str . GetLeftPart ( ':' ) , Is . EqualTo ( "user" ) ) ;
24
- Assert . That ( str . GetRightPart ( ':' ) , Is . EqualTo ( "pass@w:rd" ) ) ;
23
+ Assert . That ( str . LeftPart ( ':' ) , Is . EqualTo ( "user" ) ) ;
24
+ Assert . That ( str . RightPart ( ':' ) , Is . EqualTo ( "pass@w:rd" ) ) ;
25
25
26
- Assert . That ( str . GetLeftPart ( '|' ) , Is . EqualTo ( "user:pass@w:rd" ) ) ;
27
- Assert . That ( str . GetRightPart ( '|' ) , Is . Null ) ;
26
+ Assert . That ( str . LeftPart ( '|' ) , Is . EqualTo ( "user:pass@w:rd" ) ) ;
27
+ Assert . That ( str . RightPart ( '|' ) , Is . Null ) ;
28
28
}
29
29
30
30
[ Test ]
@@ -36,14 +36,14 @@ public void Can_SplitOnFirst_string_needle()
36
36
}
37
37
38
38
[ Test ]
39
- public void Can_GetLeftPart_and_GetLeftPart_string_needle ( )
39
+ public void Can_LeftPart_and_RightPart_string_needle ( )
40
40
{
41
41
var str = "user::pass@w:rd" ;
42
- Assert . That ( str . GetLeftPart ( "::" ) , Is . EqualTo ( "user" ) ) ;
43
- Assert . That ( str . GetRightPart ( "::" ) , Is . EqualTo ( "pass@w:rd" ) ) ;
42
+ Assert . That ( str . LeftPart ( "::" ) , Is . EqualTo ( "user" ) ) ;
43
+ Assert . That ( str . RightPart ( "::" ) , Is . EqualTo ( "pass@w:rd" ) ) ;
44
44
45
- Assert . That ( str . GetLeftPart ( "||" ) , Is . EqualTo ( "user::pass@w:rd" ) ) ;
46
- Assert . That ( str . GetRightPart ( "||" ) , Is . Null ) ;
45
+ Assert . That ( str . LeftPart ( "||" ) , Is . EqualTo ( "user::pass@w:rd" ) ) ;
46
+ Assert . That ( str . RightPart ( "||" ) , Is . Null ) ;
47
47
}
48
48
49
49
[ Test ]
@@ -54,6 +54,17 @@ public void Can_SplitOnLast_char_needle()
54
54
Assert . That ( parts [ 1 ] , Is . EqualTo ( "pass@word" ) ) ;
55
55
}
56
56
57
+ [ Test ]
58
+ public void Can_LastLeftPart_and_LastRightPart_char_needle ( )
59
+ {
60
+ var str = "user:name:pass@word" ;
61
+ Assert . That ( str . LastLeftPart ( ':' ) , Is . EqualTo ( "user:name" ) ) ;
62
+ Assert . That ( str . LastRightPart ( ':' ) , Is . EqualTo ( "pass@word" ) ) ;
63
+
64
+ Assert . That ( str . LastLeftPart ( '|' ) , Is . EqualTo ( "user:name:pass@word" ) ) ;
65
+ Assert . That ( str . LastRightPart ( '|' ) , Is . Null ) ;
66
+ }
67
+
57
68
[ Test ]
58
69
public void Can_SplitOnLast_string_needle ( )
59
70
{
@@ -62,6 +73,17 @@ public void Can_SplitOnLast_string_needle()
62
73
Assert . That ( parts [ 1 ] , Is . EqualTo ( "pass@word" ) ) ;
63
74
}
64
75
76
+ [ Test ]
77
+ public void Can_LastLeftPart_and_LastRightPart_string_needle ( )
78
+ {
79
+ var str = "user::name::pass@word" ;
80
+ Assert . That ( str . LastLeftPart ( "::" ) , Is . EqualTo ( "user::name" ) ) ;
81
+ Assert . That ( str . LastRightPart ( "::" ) , Is . EqualTo ( "pass@word" ) ) ;
82
+
83
+ Assert . That ( str . LastLeftPart ( "||" ) , Is . EqualTo ( "user::name::pass@word" ) ) ;
84
+ Assert . That ( str . LastRightPart ( "||" ) , Is . Null ) ;
85
+ }
86
+
65
87
private static readonly char DirSep = Path . DirectorySeparatorChar ;
66
88
private static readonly char AltDirSep = Path . DirectorySeparatorChar == '/' ? '\\ ' : '/' ;
67
89
0 commit comments