@@ -8,37 +8,39 @@ namespace Algorithms.Tests.Encoders;
8
8
9
9
public class BlowfishEncoderTests
10
10
{
11
- private BlowfishEncoder _encoder = new ( ) ;
12
- const string key = "aabb09182736ccdd" ;
13
-
14
- [ SetUp ]
15
- public void Setup ( )
16
- {
17
- _encoder = new BlowfishEncoder ( ) ;
18
- _encoder . GenerateKey ( key ) ;
19
- }
11
+ private const string Key = "aabb09182736ccdd" ;
20
12
21
13
[ Test ]
22
14
public void BlowfishEncoder_Encryption_ShouldWorkCorrectly ( )
23
15
{
24
- const string plainText = "123456abcd132536" ;
16
+ // Arrange
17
+ var encoder = new BlowfishEncoder ( ) ;
18
+ encoder . GenerateKey ( Key ) ;
25
19
20
+ const string plainText = "123456abcd132536" ;
26
21
const string cipherText = "d748ec383d3405f7" ;
27
22
28
- var result = _encoder . Encrypt ( plainText ) ;
23
+ // Act
24
+ var result = encoder . Encrypt ( plainText ) ;
29
25
26
+ // Assert
30
27
result . Should ( ) . Be ( cipherText ) ;
31
28
}
32
29
33
30
[ Test ]
34
31
public void BlowfishEncoder_Decryption_ShouldWorkCorrectly ( )
35
32
{
36
- const string cipherText = "d748ec383d3405f7" ;
33
+ // Arrange
34
+ var encoder = new BlowfishEncoder ( ) ;
35
+ encoder . GenerateKey ( Key ) ;
37
36
37
+ const string cipherText = "d748ec383d3405f7" ;
38
38
const string plainText = "123456abcd132536" ;
39
39
40
- var result = _encoder . Decrypt ( cipherText ) ;
40
+ // Act
41
+ var result = encoder . Decrypt ( cipherText ) ;
41
42
43
+ // Assert
42
44
result . Should ( ) . Be ( plainText ) ;
43
45
}
44
46
}
0 commit comments