1- using System ;
21using System . Collections . Generic ;
32using NUnit . Framework ;
43using Shouldly ;
5- using Stravaig . ShortCode . Tests . __helpers ;
4+ using Stravaig . Jailbreak ;
65
76namespace Stravaig . ShortCode . Tests
87{
@@ -12,9 +11,8 @@ public class ShortCodeTests
1211 [ SetUp ]
1312 public void Reset ( )
1413 {
15- var staticType = typeof ( ShortCode ) ;
16- var constructor = staticType . TypeInitializer ?? throw new InvalidOperationException ( $ "{ nameof ( ShortCode ) } is expected to have a static constructor.") ;
17- constructor . Invoke ( null , Array . Empty < object > ( ) ) ;
14+ dynamic shortCode = typeof ( ShortCode ) . Jailbreak ( ) ;
15+ shortCode . Init ( ) ;
1816 }
1917
2018 [ Test ]
@@ -76,7 +74,7 @@ public void SetCharacterSpace_HappyPath(string value, string characterSpace)
7674 public void Use_SetsTheInternalGeneratorToRandom ( )
7775 {
7876 ShortCode . Use < RandomCodeGenerator > ( ) ;
79- dynamic shortCode = new StaticJailbreak ( typeof ( ShortCode ) ) ;
77+ dynamic shortCode = typeof ( ShortCode ) . Jailbreak ( ) ;
8078 IShortCodeGenerator generator = ( IShortCodeGenerator ) shortCode . _randomGenerator ;
8179
8280 generator . ShouldNotBeNull ( ) ;
@@ -87,7 +85,7 @@ public void Use_SetsTheInternalGeneratorToRandom()
8785 public void Use_SetsTheInternalGeneratorToGuid ( )
8886 {
8987 ShortCode . Use < GuidCodeGenerator > ( ) ;
90- dynamic shortCode = new StaticJailbreak ( typeof ( ShortCode ) ) ;
88+ dynamic shortCode = typeof ( ShortCode ) . Jailbreak ( ) ;
9189 IShortCodeGenerator generator = ( IShortCodeGenerator ) shortCode . _randomGenerator ;
9290
9391 generator . ShouldNotBeNull ( ) ;
@@ -98,7 +96,7 @@ public void Use_SetsTheInternalGeneratorToGuid()
9896 public void Use_SetsTheInternalGeneratorToCryptographicallyRandom ( )
9997 {
10098 ShortCode . Use < CryptographicallyRandomCodeGenerator > ( ) ;
101- dynamic shortCode = new StaticJailbreak ( typeof ( ShortCode ) ) ;
99+ dynamic shortCode = typeof ( ShortCode ) . Jailbreak ( ) ;
102100 IShortCodeGenerator generator = ( IShortCodeGenerator ) shortCode . _randomGenerator ;
103101
104102 generator . ShouldNotBeNull ( ) ;
0 commit comments