public void SecretIsNullifiedWhenThreadIsAbortedForUseAsStringActionOfT() { var clearValue = default(string); using (var s = new Secret("a string that shall never be spoken")) { Action <Action> test = testCer => { s.UseAsString("some state", (x, c) => { clearValue = c; testCer(); }); }; test.AbortTheThread(); } clearValue.ToCharArray().Should().OnlyContain(c => c == '\0'); }
public void SecretIsDestroyedWhenThreadIsAbortedForUseAsBytesActionOfT() { var clearValue = default(byte[]); using (var s = new Secret("a string that shall never be spoken")) { Action <Action> test = testCer => { s.UseAsBytes("some state", (x, b) => { clearValue = b; testCer(); }); }; test.AbortTheThread(); } clearValue.Should().OnlyContain(b => b == 0); }