public void ShouldNotAddSameCollectorTypeTwice() { var(collector1, collector2) = (new Mock <IMetadataCollector <long> >(), new Mock <IMetadataCollector <long> >()); var handler = new TestHandler(); handler.AddCollector <IMetadataCollector <long>, long>(collector1.Object); var exc = Record.Exception(() => handler.AddCollector <IMetadataCollector <long>, long>(collector2.Object)); exc.Should().BeOfType <InvalidOperationException>(); }
public void ShouldCallCollectOnCollector() { var collector = new Mock <IMetadataCollector <long> >(); var handler = new TestHandler(); handler.AddCollector <IMetadataCollector <long>, long>(collector.Object); var metadata = new Dictionary <string, object> { { "x", 1 }, { "y", false } }; handler.OnSuccess(metadata); collector.Verify(x => x.Collect(metadata), Times.Once); }