public void ShouldNotCollectIfNoValueIsGiven() { var collector = new FieldsCollector(); collector.Collect(new Dictionary <string, object>()); collector.Collected.Should().BeNull(); }
public void ShouldNotCollectIfMetadataIsNull() { var collector = new FieldsCollector(); collector.Collect(null); collector.Collected.Should().BeNull(); }
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); }
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'."); }
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"); }