public void Transform_Throws_On_Null_Buffer() { var algorithm = Mock.Of <ICryptoAlgorithm>(); var rollingIv = new RollingIv(algorithm, new byte[] { 0x12, 0x34, 0x56, 0x78 }, 0x1234); rollingIv .Invoking(iv => iv.Transform(null)) .ShouldThrow <ArgumentNullException>(); }
public void ValidateHeader_Throws_On_Null_Segment() { var algorithm = new Mock <ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ValidateHeader(null)) .ShouldThrow <ArgumentNullException>(); }
public void ConstructHeader_Throws_For_Packets_Shorter_Than_2_Bytes() { var algorithm = new Mock <ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ConstructHeader(1).Whatever()) .ShouldThrow <ArgumentOutOfRangeException>() .WithMessagePrefix(CommonStrings.PacketLengthMustBeMoreThan2Bytes); }
public void ValidateHeader_Throws_When_Segment_Shorter_Than_4_Bytes() { var algorithm = new Mock <ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ValidateHeader(new byte[] { 0x01, 0x02, 0x03 })) .ShouldThrow <ArgumentException>() .WithMessagePrefix(SegmentMustBeLongerThan4()); }
public void ConstructHeader_Throws_For_Packets_Shorter_Than_2_Bytes() { var algorithm = new Mock<ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ConstructHeader(1).Whatever()) .ShouldThrow<ArgumentOutOfRangeException>() .WithMessagePrefix(CommonStrings.PacketLengthMustBeMoreThan2Bytes); }
public void Transform_Throws_On_Null_Buffer() { var algorithm = Mock.Of<ICryptoAlgorithm>(); var rollingIv = new RollingIv(algorithm, new byte[] { 0x12, 0x34, 0x56, 0x78 }, 0x1234); rollingIv .Invoking(iv => iv.Transform(null)) .ShouldThrow<ArgumentNullException>(); }
public void ValidateHeader_Throws_When_Segment_Shorter_Than_4_Bytes() { var algorithm = new Mock<ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ValidateHeader(new byte[] { 0x01, 0x02, 0x03 })) .ShouldThrow<ArgumentException>() .WithMessagePrefix(SegmentMustBeLongerThan4()); }
public void ValidateHeader_Throws_On_Null_Segment() { var algorithm = new Mock<ICryptoAlgorithm>(MockBehavior.Loose); var initialIv = new byte[] { 0x12, 0x34, 0x56, 0x78 }; var rollingIv = new RollingIv(algorithm.Object, initialIv, 0x1234); rollingIv .Invoking(iv => iv.ValidateHeader(null)) .ShouldThrow<ArgumentNullException>(); }