Пример #1
0
        public void ShouldNotCollectIfNoValueIsGiven()
        {
            var collector = new ConfigurationHintsCollector();

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

            collector.Collected.Should().BeNull();
        }
Пример #2
0
        public void ShouldNotCollectIfMetadataIsNull()
        {
            var collector = new ConfigurationHintsCollector();

            collector.Collect(null);

            collector.Collected.Should().BeNull();
        }
Пример #3
0
        public void ShouldThrowIfValueIsOfWrongType()
        {
            var metadata = new Dictionary <string, object> {
                { Key, "WrongType" }
            };
            var collector = new ConfigurationHintsCollector();

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

            ex.Should().BeOfType <ProtocolException>().Which
            .Message.Should().Contain($"Expected '{Key}' metadata to be of type 'Dictionary<string, object>', but got 'String'.");
        }
Пример #4
0
        public void ShouldCollect()
        {
            var hintsMetadata = new Dictionary <string, object>()
            {
                { RecvTimeoutKey, 5 }
            };
            var metadata = new Dictionary <string, object>()
            {
                { Key, hintsMetadata }
            };
            var collector = new ConfigurationHintsCollector();

            collector.Collect(metadata);

            collector.Collected.Equals(hintsMetadata);
        }