public void ShouldNotCollectIfNoValueIsGiven()
        {
            var collector = new ResultAvailableAfterCollector();

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

            collector.Collected.Should().Be(-1);
        }
        public void ShouldNotCollectIfMetadataIsNull()
        {
            var collector = new ResultAvailableAfterCollector();

            collector.Collect(null);

            collector.Collected.Should().Be(-1);
        }
        public void ShouldReturnSameCollected()
        {
            var metadata = new Dictionary <string, object> {
                { Key, 5L }
            };
            var collector = new ResultAvailableAfterCollector();

            collector.Collect(metadata);

            ((IMetadataCollector)collector).Collected.Should().Be(collector.Collected);
        }
        public void ShouldCollect()
        {
            var metadata = new Dictionary <string, object> {
                { Key, 5L }
            };
            var collector = new ResultAvailableAfterCollector();

            collector.Collect(metadata);

            collector.Collected.Should().Be(5L);
        }
        public void ShouldThrowIfValueIsOfWrongType()
        {
            var metadata = new Dictionary <string, object> {
                { Key, false }
            };
            var collector = new ResultAvailableAfterCollector();

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

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