public async Task Arn_Still_Retrieved_When_It_Already_Exists() { // Arrange string topicName = Guid.NewGuid().ToString(); ILoggerFactory loggerFactory = OutputHelper.ToLoggerFactory(); var subjectProvider = new NonGenericMessageSubjectProvider(); var serializerFactor = new NewtonsoftSerializationFactory(); var serializationRegister = new MessageSerializationRegister(subjectProvider, serializerFactor); IAmazonSimpleNotificationService client = CreateSnsClient(exists: true); var topic = new SnsTopicByName( topicName, client, serializationRegister, loggerFactory, subjectProvider); // Act await topic.CreateAsync(); // Assert topic.Arn.ShouldNotBeNull(); }
public async Task Then_An_Exception_Is_Not_Thrown() { // Arrange string topicName = Guid.NewGuid().ToString(); ILoggerFactory loggerFactory = OutputHelper.ToLoggerFactory(); IAwsClientFactory clientFactory = CreateClientFactory(); var subjectProvider = new NonGenericMessageSubjectProvider(); var serializerFactor = new NewtonsoftSerializationFactory(); var serializationRegister = new MessageSerializationRegister(subjectProvider, serializerFactor); var client = clientFactory.GetSnsClient(Region); var topic = new SnsTopicByName( topicName, client, serializationRegister, loggerFactory, subjectProvider); // Shouldn't throw await topic.CreateAsync(); await topic.CreateAsync(); topic.Arn.ShouldNotBeNull(); topic.Arn.ShouldEndWith(topic.TopicName); }
public async Task Cannot_Create_Topic_Because_It_Exists() { // Arrange string topicName = Guid.NewGuid().ToString(); ILoggerFactory loggerFactory = OutputHelper.ToLoggerFactory(); var subjectProvider = new NonGenericMessageSubjectProvider(); var serializerFactor = new NewtonsoftSerializationFactory(); var serializationRegister = new MessageSerializationRegister(subjectProvider, serializerFactor); IAmazonSimpleNotificationService client = CreateSnsClient(exists: true); var topic = new SnsTopicByName( topicName, client, serializationRegister, loggerFactory, subjectProvider); // Act bool actual = await topic.CreateAsync(); // Assert actual.ShouldBeFalse(); topic.Arn.ShouldNotBeNull(); }
private JustSaying.JustSayingBus CreateSystemUnderTest() { var subjectProvider = new GenericMessageSubjectProvider(); var serializerFactory = new NewtonsoftSerializationFactory(); var bus = new JustSaying.JustSayingBus(Config, new MessageSerializationRegister(subjectProvider, serializerFactory), LoggerFactory) { Monitor = Monitor }; bus.SetGroupSettings(new SubscriptionGroupSettingsBuilder() .WithDefaultConcurrencyLimit(8), new Dictionary <string, SubscriptionGroupConfigBuilder>()); return(bus); }
public async Task Cannot_Create_Topic_Because_Not_Authorized() { // Arrange string topicName = Guid.NewGuid().ToString(); ILoggerFactory loggerFactory = OutputHelper.ToLoggerFactory(); var subjectProvider = new NonGenericMessageSubjectProvider(); var serializerFactor = new NewtonsoftSerializationFactory(); var serializationRegister = new MessageSerializationRegister(subjectProvider, serializerFactor); IAmazonSimpleNotificationService client = CreateSnsClient(exists: false); var topic = new SnsTopicByName( topicName, client, serializationRegister, loggerFactory, subjectProvider); // Act and Assert await Assert.ThrowsAsync <InvalidOperationException>(() => topic.CreateAsync()); }