File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ private class Node
2121 private readonly Node root = new ( ) ;
2222
2323 // Bor size
24- private int size ;
24+ public int Size ;
2525
2626 /// <summary>
2727 /// Function for adding a string
@@ -41,7 +41,7 @@ public bool Add(string element)
4141 if ( node != null && ! node . Nodes . ContainsKey ( element [ i ] ) )
4242 {
4343 node . Nodes . Add ( element [ i ] , new Node ( ) ) ;
44- size ++ ;
44+ Size ++ ;
4545 }
4646
4747 if ( node != null && node . Nodes . ContainsKey ( element [ i ] ) )
@@ -68,7 +68,7 @@ public bool Contains(string element)
6868 Node ? node = root ;
6969 for ( int i = 0 ; i < element . Length ; i ++ )
7070 {
71- if ( node . Nodes . TryGetValue ( element [ i ] , out node ) )
71+ if ( node . Nodes . TryGetValue ( element [ i ] , out node ) )
7272 {
7373 continue ;
7474 }
@@ -154,10 +154,4 @@ public bool Remove(string element)
154154 ClearDictionaryAndNode ( element , index , node ) ;
155155 return true ;
156156 }
157-
158- /// <summary>
159- /// Function for returning the number of elements
160- /// </summary>
161- /// <returns> Number of elements contained in the bor </returns>
162- public int Size ( ) => size ;
163157}
Original file line number Diff line number Diff line change @@ -59,24 +59,24 @@ public void ShouldExpectedFalseWhenContainsForRemovedString()
5959 public void ShouldExpected5WhenSizeForBorContains5Node ( )
6060 {
6161 Assert . IsTrue ( bor . Add ( "hello" ) ) ;
62- Assert . AreEqual ( 5 , bor ? . Size ( ) ) ;
62+ Assert . AreEqual ( 5 , bor ? . Size ) ;
6363 }
6464
6565 [ Test ]
6666 public void ShouldBorSizeNotChangeWhenAddExistingSubstring ( )
6767 {
6868 Assert . IsTrue ( bor . Add ( "hello" ) ) ;
69- int size = bor . Size ( ) ;
69+ int size = bor . Size ;
7070 Assert . IsTrue ( bor . Add ( "hell" ) ) ;
71- Assert . AreEqual ( size , bor . Size ( ) ) ;
71+ Assert . AreEqual ( size , bor . Size ) ;
7272 }
7373
7474 [ Test ]
7575 public void ShouldBorSizeEqual8WhenAddStringLength3WithNonExistingFirstSymbolForBorContains5Node ( )
7676 {
7777 Assert . IsTrue ( bor . Add ( "hello" ) ) ;
7878 Assert . IsTrue ( bor . Add ( "bye" ) ) ;
79- Assert . AreEqual ( 8 , bor . Size ( ) ) ;
79+ Assert . AreEqual ( 8 , bor . Size ) ;
8080 }
8181
8282 [ Test ]
You can’t perform that action at this time.
0 commit comments