Exemplo n.º 1
0
        public void GetPartitionProvider_ReturnsNull_ByDefault()
        {
            // arrange
            var ps = new PublisherSettings();

            // act
            var partitionProvider = ps.GetPartitionProvider();

            // assert
            partitionProvider.Should().BeNull();
        }
Exemplo n.º 2
0
        public void PartitionProvider_CreatesUntypedWrapper()
        {
            // arrange
            var message = new SomeMessage();

            var partitionProviderMock = new Mock <Func <SomeMessage, string, int> >();

            partitionProviderMock.Setup(x => x(message, "topic1")).Returns(1);

            // act
            pb.PartitionProvider(partitionProviderMock.Object);

            // assert
            var partitionProvider = ps.GetPartitionProvider();

            partitionProvider(message, "topic1").Should().Be(1);
            partitionProviderMock.Verify(x => x(message, "topic1"), Times.Once);
        }