Esempio n. 1
0
        public void ShouldNotCollectIfNoValueIsGiven()
        {
            var collector = new ConnectionIdCollector();

            collector.Collect(new Dictionary <string, object>());

            collector.Collected.Should().BeNull();
        }
Esempio n. 2
0
        public void ShouldNotCollectIfMetadataIsNull()
        {
            var collector = new ConnectionIdCollector();

            collector.Collect(null);

            collector.Collected.Should().BeNull();
        }
Esempio n. 3
0
        public void ShouldReturnSameCollected()
        {
            var metadata = new Dictionary <string, object> {
                { Key, "id-5" }
            };
            var collector = new ConnectionIdCollector();

            collector.Collect(metadata);

            ((IMetadataCollector)collector).Collected.Should().BeSameAs(collector.Collected);
        }
Esempio n. 4
0
        public void ShouldCollect()
        {
            var metadata = new Dictionary <string, object> {
                { Key, "id-5" }
            };
            var collector = new ConnectionIdCollector();

            collector.Collect(metadata);

            collector.Collected.Should().Be("id-5");
        }
Esempio n. 5
0
        public void ShouldThrowIfValueIsOfWrongType()
        {
            var metadata = new Dictionary <string, object> {
                { Key, 5 }
            };
            var collector = new ConnectionIdCollector();

            var ex = Record.Exception(() => collector.Collect(metadata));

            ex.Should().BeOfType <ProtocolException>().Which
            .Message.Should().Contain($"Expected '{Key}' metadata to be of type 'String', but got 'Int32'.");
        }