Exemple #1
0
        public void ToBencodex()
        {
            var fullNode = new FullNode(
                Enumerable.Repeat <INode>(null, 16).ToImmutableArray()
                .Add(new ValueNode(Dictionary.Empty)).ToImmutableArray());

            var expected =
                new List(Enumerable.Repeat <IValue>(default(Null), 16).ToImmutableArray()
                         .Add(new List(new IValue[] { default(Null), Dictionary.Empty })));
            var encoded = fullNode.ToBencodex();

            Assert.IsType <List>(encoded);
            Assert.Equal(expected.Count, ((List)encoded).Count);
            Assert.Equal(expected, encoded);
        }