1
using Xunit;
2

3
namespace Libplanet.Stun.Tests.Attributes
4
{
5
    public class NonceTest
6
    {
7
        [Fact]
8
        public void ConvertToBytesProperly()
9 1
        {
10 1
            var attr = new Libplanet.Stun.Attributes.Nonce(
11 1
                new byte[]
12 1
                {
13 1
                    0x37, 0x35, 0x64, 0x34, 0x35, 0x34, 0x31, 0x39, 0x63, 0x33,
14 1
                    0x39, 0x33, 0x34, 0x33, 0x66, 0x65,
15 1
                });
16 1
            Assert.Equal(
17 1
                new byte[]
18 1
                {
19 1
                    0x00, 0x15, 0x00, 0x10, 0x37, 0x35, 0x64, 0x34, 0x35, 0x34,
20 1
                    0x31, 0x39, 0x63, 0x33, 0x39, 0x33, 0x34, 0x33, 0x66, 0x65,
21 1
                },
22 1
                attr.ToByteArray());
23 1
        }
24

25
        [Fact]
26
        public void ParseFromBytes()
27 1
        {
28 1
            Libplanet.Stun.Attributes.Nonce attr =
29 1
                Libplanet.Stun.Attributes.Nonce.Parse(
30 1
                    new byte[]
31 1
                    {
32 1
                        0x37, 0x35, 0x64, 0x34, 0x35, 0x34,
33 1
                        0x31, 0x39, 0x63, 0x33, 0x39, 0x33,
34 1
                        0x34, 0x33, 0x66, 0x65,
35 1
                    });
36 1
            Assert.Equal(
37 1
                new byte[]
38 1
                {
39 1
                    0x37, 0x35, 0x64, 0x34, 0x35, 0x34,
40 1
                    0x31, 0x39, 0x63, 0x33, 0x39, 0x33,
41 1
                    0x34, 0x33, 0x66, 0x65,
42 1
                },
43 1
                attr.Value);
44 1
        }
45
    }
46
}

Read our documentation on viewing source code .

Loading