File tree 3 files changed +438
-0
lines changed
Algorithms.Tests/Encoders
3 files changed +438
-0
lines changed Original file line number Diff line number Diff line change
1
+ using Algorithms . Encoders ;
2
+ using FluentAssertions ;
3
+ using NUnit . Framework ;
4
+
5
+ namespace Algorithms . Tests . Encoders ;
6
+
7
+ // Tests ported from the Java Algorithms repository
8
+
9
+ public class BlowfishEncoderTests
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
+ }
20
+
21
+ [ Test ]
22
+ public void BlowfishEncoder_Encryption_ShouldWorkCorrectly ( )
23
+ {
24
+ const string plainText = "123456abcd132536" ;
25
+
26
+ const string cipherText = "d748ec383d3405f7" ;
27
+
28
+ var result = _encoder . Encrypt ( plainText ) ;
29
+
30
+ result . Should ( ) . Be ( cipherText ) ;
31
+ }
32
+
33
+ [ Test ]
34
+ public void BlowfishEncoder_Decryption_ShouldWorkCorrectly ( )
35
+ {
36
+ const string cipherText = "d748ec383d3405f7" ;
37
+
38
+ const string plainText = "123456abcd132536" ;
39
+
40
+ var result = _encoder . Decrypt ( cipherText ) ;
41
+
42
+ result . Should ( ) . Be ( plainText ) ;
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments