コード例 #1
0
        public void PreAuthEncodeSpy_WhenTestString_ExpectKnownResponse()
        {
            var testBytes = System.Text.Encoding.UTF8.GetBytes("test");

            var encodedValue = TestPasetoVersionStrategy.PreAuthEncodeSpy(new[] { testBytes });

            encodedValue.Should().BeEquivalentTo(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 }.Concat(testBytes));
        }
コード例 #2
0
        public void PreAuthEncodeSpy_WhenEmptyCollection_ExpectKnownResponse()
        {
            var encodedValue = TestPasetoVersionStrategy.PreAuthEncodeSpy(new List <byte[]>());

            encodedValue.Should().BeEquivalentTo(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 });
        }
コード例 #3
0
        public void PreAuthEncodeSpy_WhenEmptyString_ExpectKnownResponse()
        {
            var encodedValue = TestPasetoVersionStrategy.PreAuthEncodeSpy(new[] { System.Text.Encoding.UTF8.GetBytes(string.Empty) });

            encodedValue.Should().BeEquivalentTo(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
        }
コード例 #4
0
 public void PreAuthEncode_WhenPiecesIsNull_ExpectArgumentNullException()
 => Assert.Throws <ArgumentNullException>(() => TestPasetoVersionStrategy.PreAuthEncodeSpy(null));