public void Encrypts_header_then_calculates_header_mac() { IByteBuffer result = Unpooled.Buffer(256); UnderTest underTest = new UnderTest(_frameCipher, _macProcessor); underTest.Encode(_frame, result); Received.InOrder( () => { _frameCipher.Received().Encrypt(_frame, 0, 16, _frame, 0); _macProcessor.Received().AddMac(_frame, 0, 16, true); } ); }
public void Checks_header_mac_then_decrypts() { IByteBuffer buffer = Unpooled.Buffer(256); buffer.WriteBytes(_frame); UnderTest underTest = new UnderTest(_frameCipher, _macProcessor); underTest.Decode(buffer); Received.InOrder( () => { _macProcessor.Received().CheckMac(Arg.Any <byte[]>(), 0, 16, true); _frameCipher.Received().Decrypt(Arg.Any <byte[]>(), 0, 16, Arg.Any <byte[]>(), 0); } ); }