private void Assert(BsonTrie<int> trie, string name)
        {
            var subject = new TrieNameDecoder<int>(trie);

            using (var memoryStream = new MemoryStream())
            using (var bsonStream = new BsonStreamAdapter(memoryStream))
            {
                bsonStream.WriteCString(name);
                bsonStream.WriteInt32(20);
                bsonStream.Position = 0;

                var result = subject.Decode(bsonStream, Utf8Encodings.Strict);

                result.Should().Be(name);
            }
        }
예제 #2
0
        private void Assert(BsonTrie <int> trie, string name)
        {
            var subject = new TrieNameDecoder <int>(trie);

            using (var memoryStream = new MemoryStream())
                using (var bsonStream = new BsonStreamAdapter(memoryStream))
                {
                    bsonStream.WriteCString(name);
                    bsonStream.WriteInt32(20);
                    bsonStream.Position = 0;

                    var result = subject.Decode(bsonStream, Utf8Encodings.Strict);

                    result.Should().Be(name);
                }
        }
        // private methods
        private void Assert(string name, TrieNameDecoder <int> subject, bool found, int value)
        {
            using (var memoryStream = new MemoryStream())
                using (var bsonStream = new BsonStreamAdapter(memoryStream))
                {
                    bsonStream.WriteCString(name);
                    bsonStream.WriteInt32(20);
                    bsonStream.Position = 0;

                    var result = subject.Decode(bsonStream, Utf8Encodings.Strict);

                    result.Should().Be(name);
                    subject.Found.Should().Be(found);
                    subject.Value.Should().Be(value);
                }
        }