Пример #1
0
        public void GetKeyProvider_ReturnsNull_ByDefault()
        {
            // arrange
            var ps = new PublisherSettings();

            // act
            var keyProvider = ps.GetKeyProvider();

            // assert
            keyProvider.Should().BeNull();
        }
Пример #2
0
        public void KeyProvider_CreatesUntypedWrapper()
        {
            // arrange
            var message    = new SomeMessage();
            var messageKey = new byte[] { 1, 2 };

            var keyProviderMock = new Mock <Func <SomeMessage, string, byte[]> >();

            keyProviderMock.Setup(x => x(message, "topic1")).Returns(messageKey);

            // act
            pb.KeyProvider(keyProviderMock.Object);

            // assert
            var keyProvider = ps.GetKeyProvider();

            keyProvider(message, "topic1").Should().BeSameAs(messageKey);
            keyProviderMock.Verify(x => x(message, "topic1"), Times.Once);
        }