Exemplo n.º 1
0
        public void ShouldNotCollectIfNoValueIsGiven()
        {
            var collector = new FieldsCollector();

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

            collector.Collected.Should().BeNull();
        }
Exemplo n.º 2
0
        public void ShouldNotCollectIfMetadataIsNull()
        {
            var collector = new FieldsCollector();

            collector.Collect(null);

            collector.Collected.Should().BeNull();
        }
Exemplo n.º 3
0
        public void ShouldReturnSameCollected()
        {
            var metadata = new Dictionary <string, object> {
                { Key, new List <object> {
                      "field-1", "field-2", "field-3"
                  } }
            };
            var collector = new FieldsCollector();

            collector.Collect(metadata);

            ((IMetadataCollector)collector).Collected.Should().BeSameAs(collector.Collected);
        }
Exemplo n.º 4
0
        public void ShouldThrowIfValueIsOfWrongType()
        {
            var metadata = new Dictionary <string, object> {
                { Key, "some string" }
            };
            var collector = new FieldsCollector();

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

            ex.Should().BeOfType <ProtocolException>().Which
            .Message.Should()
            .Contain($"Expected '{Key}' metadata to be of type 'List<Object>', but got 'String'.");
        }
Exemplo n.º 5
0
        public void ShouldCollect()
        {
            var metadata = new Dictionary <string, object> {
                { Key, new List <object> {
                      "field-1", "field-2", "field-3"
                  } }
            };
            var collector = new FieldsCollector();

            collector.Collect(metadata);

            collector.Collected.Should().HaveCount(3).And
            .ContainInOrder("field-1", "field-2", "field-3");
        }