예제 #1
0
 public void ConstructorShouldThrowExceptionDateIsBefore1970()
 {
     Assert2.ShouldThrow <ArgumentException>(() => new PGPTime(DateTime.Parse("1969-07-21T02:56:00.0000000")));
     Assert2.ShouldThrow <ArgumentException>(() => new PGPTime(DateTime.Parse("1776-07-04T00:00:00.0000000")));
     Assert2.ShouldThrow <ArgumentException>(() => new PGPTime(DateTime.Parse("1816-07-09T00:00:00.0000000")));
 }
 public void ToUInt64ShouldThrowExceptionOnInvalidStartIndex()
 {
     Assert2.ShouldThrow <ArgumentOutOfRangeException>(() => BigEndianBitConverter.ToUInt64(new byte[8], -1));
     Assert2.ShouldThrow <ArgumentOutOfRangeException>(() => BigEndianBitConverter.ToUInt64(new byte[8], 100));
 }
 public void ToUInt32ShouldThrowExceptionIfNotEnoughBytes()
 {
     Assert2.ShouldThrow <ArgumentException>(() => BigEndianBitConverter.ToUInt32(new byte[4], 1));
     Assert2.ShouldThrow <ArgumentException>(() => BigEndianBitConverter.ToUInt32(new byte[10], 7));
     Assert2.ShouldThrow <ArgumentException>(() => BigEndianBitConverter.ToUInt32(new byte[77], 74));
 }
 public void ToUInt64ShouldThrowExceptionOnNullInput()
 {
     Assert2.ShouldThrow <ArgumentNullException>(() => BigEndianBitConverter.ToUInt64(null, 0));
 }
예제 #5
0
 public void ReadShouldThrowExceptionIfNotArmored()
 {
     Assert2.ShouldThrow <PGPException>(() => RunNotArmoredTest("Plaintext001.txt"), "Unable to locate beginning of ASCII armor");
     Assert2.ShouldThrow <PGPException>(() => RunNotArmoredTest("Plaintext002.txt"), "Unable to locate beginning of ASCII armor");
     Assert2.ShouldThrow <PGPException>(() => RunNotArmoredTest("Plaintext003.txt"), "Unable to locate beginning of ASCII armor");
 }