1- using NUnit . Framework ;
2-
3- using BorSpace ;
1+ namespace BorTest ;
42
5- using System ;
3+ using NUnit . Framework ;
4+ using Bor ;
65
7- namespace BorTest
6+ public class BorTest
87{
9- public class Tests
10- {
11- Bor ? bor ;
12- [ SetUp ]
13- public void Setup ( )
14- {
15- bor = new Bor ( ) ;
16- }
8+ Bor bor = new ( ) ;
179
18- [ Test ]
19- public void DeleteLineFromEmptyBor ( )
20- {
21- Assert . IsFalse ( bor ? . Remove ( "hello" ) ) ;
22- }
10+ [ SetUp ]
11+ public void Setup ( )
12+ {
13+ bor = new ( ) ;
14+ }
2315
24- [ Test ]
25- public void AddExistingString ( )
26- {
27- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
28- Assert . IsFalse ( bor ? . Add ( "hello" ) ) ;
29- }
16+ [ Test ]
17+ public void ShouldExpectedFalseWhenRemoveFromEmptyBor ( )
18+ {
19+ Assert . IsFalse ( bor . Remove ( "hello" ) ) ;
20+ }
3021
31- [ Test ]
32- public void FindNonExistentString ( )
33- {
34- Assert . IsFalse ( bor ? . Contains ( "hello" ) ) ;
35- }
22+ [ Test ]
23+ public void ShouldExpectedFalseWhenAddExistingString ( )
24+ {
25+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
26+ Assert . IsFalse ( bor . Add ( "hello" ) ) ;
27+ }
3628
37- [ Test ]
38- public void FindStringAfterAdd ( )
39- {
40- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
41- Assert . IsTrue ( bor ? . Contains ( "hello" ) ) ;
42- }
29+ [ Test ]
30+ public void ShouldExpectedFalseWhenContainsForNonExistingString ( )
31+ {
32+ Assert . IsFalse ( bor . Contains ( "hello" ) ) ;
33+ }
4334
44- [ Test ]
45- public void RemoveStringAfterRemove ( )
46- {
47- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
48- Assert . IsTrue ( bor ? . Remove ( "hello" ) ) ;
49- Assert . IsFalse ( bor ? . Remove ( "hello" ) ) ;
50- }
35+ [ Test ]
36+ public void ShouldExpectedTrueWhenContainsForExistingString ( )
37+ {
38+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
39+ Assert . IsTrue ( bor . Contains ( "hello" ) ) ;
40+ }
5141
52- [ Test ]
53- public void FindStringAfterRemove ( )
54- {
55- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
56- Assert . IsTrue ( bor ? . Remove ( "hello" ) ) ;
57- Assert . IsFalse ( bor ? . Contains ( "hello" ) ) ;
58- }
42+ [ Test ]
43+ public void ShouldExpectedFalseWhenRemoveForRemovedString ( )
44+ {
45+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
46+ Assert . IsTrue ( bor . Remove ( "hello" ) ) ;
47+ Assert . IsFalse ( bor . Remove ( "hello" ) ) ;
48+ }
5949
60- [ Test ]
61- public void FindSizeAfterAdd ( )
62- {
63- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
64- Assert . AreEqual ( bor ? . Size ( ) , 5 ) ;
65- }
50+ [ Test ]
51+ public void ShouldExpectedFalseWhenContainsForRemovedString ( )
52+ {
53+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
54+ Assert . IsTrue ( bor . Remove ( "hello" ) ) ;
55+ Assert . IsFalse ( bor . Contains ( "hello" ) ) ;
56+ }
6657
67- [ Test ]
68- public void FindSizeAfterAddStringFromExistingSymbol ( )
69- {
70- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
71- Assert . IsTrue ( bor ? . Add ( "hell" ) ) ;
72- Assert . AreEqual ( bor ? . Size ( ) , 5 ) ;
73- }
58+ [ Test ]
59+ public void ShouldExpected5WhenSizeForBorContains5Node ( )
60+ {
61+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
62+ Assert . AreEqual ( 5 , bor ? . Size ) ;
63+ }
7464
75- [ Test ]
76- public void FindSizeAfterAddStringFromNonExistingSymbol ( )
77- {
78- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
79- Assert . IsTrue ( bor ? . Add ( "bye" ) ) ;
80- Assert . AreEqual ( bor ? . Size ( ) , 8 ) ;
81- }
65+ [ Test ]
66+ public void ShouldBorSizeNotChangeWhenAddExistingSubstring ( )
67+ {
68+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
69+ int size = bor . Size ;
70+ Assert . IsTrue ( bor . Add ( "hell" ) ) ;
71+ Assert . AreEqual ( size , bor . Size ) ;
72+ }
8273
83- [ Test ]
84- public void FindSizeAfterAddStringFromSomeMatchingSymbol ( )
85- {
86- Assert . IsTrue ( bor ? . Add ( "hello" ) ) ;
87- Assert . IsTrue ( bor ? . Add ( "hey " ) ) ;
88- Assert . AreEqual ( bor ? . Size ( ) , 6 ) ;
89- }
74+ [ Test ]
75+ public void ShouldBorSizeEqual8WhenAddStringLength3WithNonExistingFirstSymbolForBorContains5Node ( )
76+ {
77+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
78+ Assert . IsTrue ( bor . Add ( "bye " ) ) ;
79+ Assert . AreEqual ( 8 , bor . Size ) ;
80+ }
9081
91- [ Test ]
92- public void FindStringFromInvalidSymbol ( )
93- {
94- Assert . Throws < MyException > ( ( ) => bor ? . Contains ( "ÿÿÿÿ" ) ) ;
95- }
82+ [ Test ]
83+ public void ShouldExpected2WhenHowManyStartWithPrefixForBorContains2StringWhichStartWithThisPrefix ( )
84+ {
85+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
86+ Assert . IsTrue ( bor . Add ( "hel" ) ) ;
87+ Assert . AreEqual ( 2 , bor . HowManyStartWithPrefix ( "hel" ) ) ;
88+ }
9689
97- [ Test ]
98- public void RemoveNonExistentString ( )
99- {
100- Assert . Throws < MyException > ( ( ) => bor ? . Remove ( "ÿÿÿÿ" ) ) ;
101- }
90+ [ Test ]
91+ public void ShouldExpected0WhenHowManyStartWithPrefixForNonExistingPrefix ( )
92+ {
93+ Assert . IsTrue ( bor . Add ( "hello" ) ) ;
94+ Assert . IsTrue ( bor . Add ( "bye" ) ) ;
95+ Assert . AreEqual ( 0 , bor . HowManyStartWithPrefix ( "leee" ) ) ;
10296 }
10397}
0 commit comments