Beispiel #1
0
        public void ShouldGetTopicNameFromTopicAttribute()
        {
            //Arrange
            var options                      = new NotificationOptions();
            var configurationMock            = new Mock <IConfiguration>();
            var notificationAttributesReader = new NotificationAttributesReader(options, configurationMock.Object);

            //Act
            var topicName = notificationAttributesReader.GetTopicName(typeof(TestNotificationWithNammedTopic));

            //Assert
            Assert.Equal("expected-topic-name", topicName);
        }
Beispiel #2
0
        public void ShouldGetTopicNameFromIConfiguration()
        {
            //Arrange
            var options           = new NotificationOptions();
            var configurationKey  = $"{nameof(NotificationOptions)}:{nameof(TestNotification)}Topic";
            var configurationMock = new Mock <IConfiguration>();

            configurationMock.Setup(x => x[configurationKey]).Returns("configured-topic-name");

            var notificationAttributesReader = new NotificationAttributesReader(options, configurationMock.Object);

            //Act
            var topicName = notificationAttributesReader.GetTopicName(typeof(TestNotification));

            //Assert
            Assert.Equal("configured-topic-name", topicName);
        }