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); }
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); }