public static void Ctor() { var actual = new Nonce(); Assert.Equal(0, actual.Size); Assert.Equal(0, actual.FixedFieldSize); Assert.Equal(0, actual.CounterFieldSize); Assert.Equal(Array.Empty <byte>(), actual.ToArray()); Assert.Equal("[][]", actual.GetDebuggerDisplay()); actual.CopyTo(Span <byte> .Empty); }
public static void CtorWithCounterSize(int size) { var expected = new byte[size]; var actual = new Nonce(0, size); var array = new byte[expected.Length]; Assert.Equal(expected.Length, actual.Size); Assert.Equal(0, actual.FixedFieldSize); Assert.Equal(expected.Length, actual.CounterFieldSize); Assert.Equal(expected, actual.ToArray()); Assert.Equal("[][" + expected.EncodeHex() + "]", actual.GetDebuggerDisplay()); actual.CopyTo(array); Assert.Equal(expected, array); }
public static void CtorWithFixedAndCounterSize(int size) { var fixedField = Utilities.RandomBytes.Slice(0, size / 2).ToArray(); var counterField = new byte[size - fixedField.Length]; var expected = new byte[size]; var actual = new Nonce(fixedField, counterField.Length); var array = new byte[expected.Length]; fixedField.CopyTo(expected, 0); Assert.Equal(expected.Length, actual.Size); Assert.Equal(fixedField.Length, actual.FixedFieldSize); Assert.Equal(counterField.Length, actual.CounterFieldSize); Assert.Equal(expected, actual.ToArray()); Assert.Equal("[" + fixedField.EncodeHex() + "][" + counterField.EncodeHex() + "]", actual.GetDebuggerDisplay()); actual.CopyTo(array); Assert.Equal(expected, array); }