diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..b7061b0
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,140 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = crlf
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{csproj,json,props,ruleset,targets}]
+indent_size = 2
+
+# Code files
+[*.{cs,csx,vb,vbx}]
+indent_size = 4
+insert_final_newline = true
+charset = utf-8-bom
+
+###############################
+# .NET Coding Conventions #
+###############################
+[*.{cs,vb}]
+# Organize usings
+dotnet_sort_system_directives_first = true
+
+# this. preferences
+dotnet_style_qualification_for_field = false:none
+dotnet_style_qualification_for_property = false:none
+dotnet_style_qualification_for_method = false:none
+dotnet_style_qualification_for_event = false:none
+
+# Language keywords vs BCL types preferences
+dotnet_style_predefined_type_for_locals_parameters_members = true:none
+dotnet_style_predefined_type_for_member_access = true:none
+
+# Modifier preferences
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:none
+dotnet_style_readonly_field = true:suggestion
+
+# Expression-level preferences
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_explicit_tuple_names = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:none
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_auto_properties = true:none
+
+# Public API analyzer preferences
+dotnet_public_api_analyzer.require_api_files = true
+
+###############################
+# Naming Conventions #
+###############################
+
+# Style Definitions
+dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+
+# Use PascalCase for constant fields
+dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
+dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
+dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_symbols.constant_fields.applicable_kinds = field
+dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
+dotnet_naming_symbols.constant_fields.required_modifiers = const
+
+###############################
+# C# Coding Conventions #
+###############################
+[*.cs]
+# var preferences
+csharp_style_var_for_built_in_types = true:none
+csharp_style_var_when_type_is_apparent = true:none
+csharp_style_var_elsewhere = true:none
+
+# Expression-bodied members
+csharp_style_expression_bodied_methods = false:none
+csharp_style_expression_bodied_constructors = false:none
+csharp_style_expression_bodied_operators = false:none
+csharp_style_expression_bodied_properties = true:none
+csharp_style_expression_bodied_indexers = true:none
+csharp_style_expression_bodied_accessors = true:none
+
+# Pattern matching preferences
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+
+# Null-checking preferences
+csharp_style_throw_expression = true:suggestion
+csharp_style_conditional_delegate_call = true:suggestion
+
+# Modifier preferences
+csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
+
+# Expression-level preferences
+csharp_prefer_braces = true:none
+csharp_style_deconstructed_variable_declaration = true:suggestion
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_style_pattern_local_over_anonymous_function = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+
+# Namespace preferences
+csharp_style_namespace_declarations = file_scoped
+
+###############################
+# C# Formatting Rules #
+###############################
+# New line preferences
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_anonymous_types = true
+csharp_new_line_between_query_expression_clauses = true
+
+# Indentation preferences
+csharp_indent_case_contents = true
+csharp_indent_switch_labels = true
+csharp_indent_labels = flush_left
+
+# Space preferences
+csharp_space_after_cast = false
+csharp_space_after_keywords_in_control_flow_statements = true
+csharp_space_between_method_call_parameter_list_parentheses = false
+csharp_space_between_method_declaration_parameter_list_parentheses = false
+csharp_space_between_parentheses = false
+csharp_space_before_colon_in_inheritance_clause = true
+csharp_space_after_colon_in_inheritance_clause = true
+csharp_space_around_binary_operators = before_and_after
+csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
+csharp_space_between_method_call_name_and_opening_parenthesis = false
+csharp_space_between_method_call_empty_parameter_list_parentheses = false
+
+# Wrapping preferences
+csharp_preserve_single_line_statements = true
+csharp_preserve_single_line_blocks = true
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 73a2a0b..053e2e2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -6,10 +6,10 @@
-
+
diff --git a/tests/LocalSqsSnsMessaging.Tests.Shared/LocalSqsSnsMessaging.Tests.Shared.csproj b/tests/LocalSqsSnsMessaging.Tests.Shared/LocalSqsSnsMessaging.Tests.Shared.csproj
index 3f87478..2d731fc 100644
--- a/tests/LocalSqsSnsMessaging.Tests.Shared/LocalSqsSnsMessaging.Tests.Shared.csproj
+++ b/tests/LocalSqsSnsMessaging.Tests.Shared/LocalSqsSnsMessaging.Tests.Shared.csproj
@@ -1,15 +1,15 @@
- Library
- net8.0
- enable
- enable
- $(NoWarn);CA1051;CA2007;CA1707
- false
- false
- false
- false
+ Library
+ net8.0
+ enable
+ enable
+ $(NoWarn);CA1051;CA2007;CA1707
+ false
+ false
+ false
+ false
@@ -17,10 +17,10 @@
-
-
-
-
+
+
+
+
diff --git a/tests/LocalSqsSnsMessaging.Tests.Shared/SnsPublishAsyncTests.cs b/tests/LocalSqsSnsMessaging.Tests.Shared/SnsPublishAsyncTests.cs
index f407d9b..bdddee3 100644
--- a/tests/LocalSqsSnsMessaging.Tests.Shared/SnsPublishAsyncTests.cs
+++ b/tests/LocalSqsSnsMessaging.Tests.Shared/SnsPublishAsyncTests.cs
@@ -1,10 +1,10 @@
-using System.Security.Cryptography;
+using System.Security.Cryptography;
using System.Text.Json;
using Amazon.SimpleNotificationService;
using Amazon.SimpleNotificationService.Model;
using Amazon.SQS;
using Amazon.SQS.Model;
-using FluentAssertions;
+using Shouldly;
using MessageAttributeValue = Amazon.SimpleNotificationService.Model.MessageAttributeValue;
@@ -49,7 +49,7 @@ public async Task PublishAsync_WithRawDelivery_ShouldDeliverMessageDirectly()
var response = await Sns.PublishAsync(request, TestContext.Current.CancellationToken);
// Assert
- response.MessageId.Should().NotBeNullOrEmpty();
+ response.MessageId.ShouldNotBeNullOrEmpty();
var queueUrlResponse = await Sqs.GetQueueUrlAsync(new GetQueueUrlRequest { QueueName = "MyQueue" },
TestContext.Current.CancellationToken);
@@ -63,10 +63,10 @@ public async Task PublishAsync_WithRawDelivery_ShouldDeliverMessageDirectly()
MessageAttributeNames = ["All"]
}, TestContext.Current.CancellationToken);
- var sqsMessage = sqsMessages.Messages.Should().ContainSingle().Subject;
- sqsMessage.Body.Should().Be("Test message");
- sqsMessage.MessageAttributes.Should().ContainKey("TestAttribute")
- .WhoseValue.StringValue.Should().Be("TestValue");
+ var sqsMessage = Assert.Single(sqsMessages.Messages);
+ sqsMessage.Body.ShouldBe("Test message");
+ sqsMessage.MessageAttributes.ShouldContainKey("TestAttribute");
+ sqsMessage.MessageAttributes["TestAttribute"].StringValue.ShouldBe("TestValue");
}
[Fact, Trait("Category", "TimeBasedTests")]
@@ -94,7 +94,7 @@ public async Task PublishAsync_WithRawDelivery_ShouldCalculateMD5OfBody()
var response = await Sns.PublishAsync(request, TestContext.Current.CancellationToken);
// Assert
- response.MessageId.Should().NotBeNullOrEmpty();
+ response.MessageId.ShouldNotBeNullOrEmpty();
var queueUrlResponse = await Sqs.GetQueueUrlAsync(new GetQueueUrlRequest { QueueName = "MyQueue" },
TestContext.Current.CancellationToken);
@@ -108,8 +108,8 @@ public async Task PublishAsync_WithRawDelivery_ShouldCalculateMD5OfBody()
MessageAttributeNames = ["All"]
}, TestContext.Current.CancellationToken);
- var sqsMessage = sqsMessages.Messages.Should().ContainSingle().Subject;
- sqsMessage.MD5OfBody.Should().Be(expectedHash);
+ var sqsMessage = Assert.Single(sqsMessages.Messages);
+ sqsMessage.MD5OfBody.ShouldBe(expectedHash);
}
[Fact, Trait("Category", "TimeBasedTests")]
@@ -136,7 +136,7 @@ public async Task PublishAsync_WithNonRawDelivery_ShouldWrapMessageInSNSFormat()
var response = await Sns.PublishAsync(request, TestContext.Current.CancellationToken);
// Assert
- response.MessageId.Should().NotBeNullOrEmpty();
+ response.MessageId.ShouldNotBeNullOrEmpty();
var queueUrlResponse = await Sqs.GetQueueUrlAsync(new GetQueueUrlRequest { QueueName = "MyQueue" },
TestContext.Current.CancellationToken);
@@ -150,23 +150,23 @@ public async Task PublishAsync_WithNonRawDelivery_ShouldWrapMessageInSNSFormat()
MessageAttributeNames = ["All"]
}, TestContext.Current.CancellationToken);
- var sqsMessage = sqsMessages.Messages.Should().ContainSingle().Subject;
+ var sqsMessage = Assert.Single(sqsMessages.Messages);
// Parse the JSON body using JsonDocument
using var jsonDocument = JsonDocument.Parse(sqsMessage.Body);
var root = jsonDocument.RootElement;
- root.GetProperty("Type").GetString().Should().Be("Notification");
- root.GetProperty("MessageId").GetString().Should().Be(response.MessageId);
- root.GetProperty("TopicArn").GetString().Should().Be(topicArn);
- root.GetProperty("Subject").GetString().Should().Be("Test Subject");
- root.GetProperty("Message").GetString().Should().Be("Test message");
- root.GetProperty("Timestamp").GetString().Should().NotBeNullOrEmpty();
+ root.GetProperty("Type").GetString().ShouldBe("Notification");
+ root.GetProperty("MessageId").GetString().ShouldBe(response.MessageId);
+ root.GetProperty("TopicArn").GetString().ShouldBe(topicArn);
+ root.GetProperty("Subject").GetString().ShouldBe("Test Subject");
+ root.GetProperty("Message").GetString().ShouldBe("Test message");
+ root.GetProperty("Timestamp").GetString().ShouldNotBeNullOrEmpty();
// Check MessageAttributes in the SNS message body
var messageAttributes = root.GetProperty("MessageAttributes");
- messageAttributes.GetProperty("TestAttribute").GetProperty("Type").GetString().Should().Be("String");
- messageAttributes.GetProperty("TestAttribute").GetProperty("Value").GetString().Should().Be("TestValue");
+ messageAttributes.GetProperty("TestAttribute").GetProperty("Type").GetString().ShouldBe("String");
+ messageAttributes.GetProperty("TestAttribute").GetProperty("Value").GetString().ShouldBe("TestValue");
}
[Fact]
@@ -217,7 +217,7 @@ public async Task SetTopicAttributes_ShouldSetAndRetrieveAttributes()
// Create the topic
var createTopicResponse = await Sns.CreateTopicAsync(new CreateTopicRequest { Name = topicName },
TestContext.Current.CancellationToken);
- createTopicResponse.TopicArn.Should().Be(topicArn);
+ createTopicResponse.TopicArn.ShouldBe(topicArn);
// Act - Set topic attributes
await Sns.SetTopicAttributesAsync(new SetTopicAttributesRequest
@@ -256,18 +256,18 @@ await Sns.SetTopicAttributesAsync(new SetTopicAttributesRequest
TopicArn = topicArn
}, TestContext.Current.CancellationToken);
- getTopicAttributesResponse.Attributes.Should().ContainKey("DisplayName")
- .WhoseValue.Should().Be("Test Display Name");
+ getTopicAttributesResponse.Attributes.ShouldContainKey("DisplayName");
+ getTopicAttributesResponse.Attributes["DisplayName"].ShouldBe("Test Display Name");
- getTopicAttributesResponse.Attributes.Should().ContainKey("DeliveryPolicy");
+ getTopicAttributesResponse.Attributes.ShouldContainKey("DeliveryPolicy");
var deliveryPolicy =
JsonSerializer.Deserialize(getTopicAttributesResponse.Attributes["DeliveryPolicy"]);
deliveryPolicy.GetProperty("http").GetProperty("defaultHealthyRetryPolicy").GetProperty("minDelayTarget")
- .GetInt32().Should().Be(20);
+ .GetInt32().ShouldBe(20);
deliveryPolicy.GetProperty("http").GetProperty("defaultHealthyRetryPolicy").GetProperty("maxDelayTarget")
- .GetInt32().Should().Be(20);
+ .GetInt32().ShouldBe(20);
deliveryPolicy.GetProperty("http").GetProperty("defaultHealthyRetryPolicy").GetProperty("numRetries").GetInt32()
- .Should().Be(3);
+ .ShouldBe(3);
}
[Fact]
@@ -321,22 +321,17 @@ await Sqs.CreateQueueAsync(new CreateQueueRequest { QueueName = queueName },
}, TestContext.Current.CancellationToken);
// Assert
- getAttributesResponse.Attributes.Should().ContainKey("SubscriptionArn")
- .WhoseValue.Should().Be(subscribeResponse.SubscriptionArn);
- getAttributesResponse.Attributes.Should().ContainKey("TopicArn")
- .WhoseValue.Should().Be(topicArn);
- getAttributesResponse.Attributes.Should().ContainKey("Protocol")
- .WhoseValue.Should().BeEquivalentTo("sqs");
- getAttributesResponse.Attributes.Should().ContainKey("Endpoint")
- .WhoseValue.Should().BeEquivalentTo(queueArn);
- getAttributesResponse.Attributes.Should().ContainKey("RawMessageDelivery")
- .WhoseValue.Should().BeEquivalentTo("true");
- getAttributesResponse.Attributes.Should().ContainKey("FilterPolicy")
- .WhoseValue.Should().NotBeNullOrEmpty();
+ getAttributesResponse.Attributes.ShouldContainKeyAndValue("SubscriptionArn", subscribeResponse.SubscriptionArn);
+ getAttributesResponse.Attributes.ShouldContainKeyAndValue("TopicArn", topicArn);
+ getAttributesResponse.Attributes.ShouldContainKeyAndValue("Protocol", "sqs");
+ getAttributesResponse.Attributes.ShouldContainKeyAndValue("Endpoint", queueArn);
+ getAttributesResponse.Attributes.ShouldContainKey("RawMessageDelivery");
+ getAttributesResponse.Attributes["RawMessageDelivery"].ShouldBe("true", StringCompareShould.IgnoreCase);
+ getAttributesResponse.Attributes.ShouldContainKey("FilterPolicy");
+ getAttributesResponse.Attributes["FilterPolicy"].ShouldNotBeNullOrEmpty();
var filterPolicy = JsonSerializer.Deserialize(getAttributesResponse.Attributes["FilterPolicy"]);
- filterPolicy.GetProperty("attribute").EnumerateArray().Select(x => x.GetString()).Should()
- .BeEquivalentTo("value1", "value2");
+ filterPolicy.GetProperty("attribute").EnumerateArray().Select(x => x.GetString()).ShouldBe(["value1", "value2"]);
}
[Fact]
@@ -396,10 +391,10 @@ await Sns.SetSubscriptionAttributesAsync(new SetSubscriptionAttributesRequest
SubscriptionArn = subscribeResponse.SubscriptionArn
}, TestContext.Current.CancellationToken);
- getAttributesResponse.Attributes.Should().ContainKey("RawMessageDelivery")
- .WhoseValue.Should().BeEquivalentTo("true");
- getAttributesResponse.Attributes.Should().ContainKey("FilterPolicy")
- .WhoseValue.Should().BeEquivalentTo(newFilterPolicy);
+ getAttributesResponse.Attributes.ShouldContainKey("RawMessageDelivery");
+ getAttributesResponse.Attributes["RawMessageDelivery"].ShouldBe("true", StringCompareShould.IgnoreCase);
+ getAttributesResponse.Attributes.ShouldContainKey("FilterPolicy");
+ getAttributesResponse.Attributes["FilterPolicy"].ShouldBeEquivalentTo(newFilterPolicy);
}
// List Subscriptions
@@ -437,13 +432,13 @@ await Sqs.CreateQueueAsync(new CreateQueueRequest { QueueName = queueName },
var listResponse = await Sns.ListSubscriptionsAsync(TestContext.Current.CancellationToken);
// Assert
- listResponse.Subscriptions.Should().HaveCountGreaterThanOrEqualTo(2);
- listResponse.Subscriptions.Should().Contain(s => s.SubscriptionArn == sub1.SubscriptionArn);
- listResponse.Subscriptions.Should().Contain(s => s.SubscriptionArn == sub2.SubscriptionArn);
- listResponse.Subscriptions.Should().Contain(s => s.TopicArn == topic1Arn);
- listResponse.Subscriptions.Should().Contain(s => s.TopicArn == topic2Arn);
- listResponse.Subscriptions.Should().OnlyContain(s => s.Protocol == "sqs");
- listResponse.Subscriptions.Should().OnlyContain(s => s.Endpoint == queueArn);
+ listResponse.Subscriptions.Count.ShouldBeGreaterThanOrEqualTo(2);
+ listResponse.Subscriptions.ShouldContain(s => s.SubscriptionArn == sub1.SubscriptionArn);
+ listResponse.Subscriptions.ShouldContain(s => s.SubscriptionArn == sub2.SubscriptionArn);
+ listResponse.Subscriptions.ShouldContain(s => s.TopicArn == topic1Arn);
+ listResponse.Subscriptions.ShouldContain(s => s.TopicArn == topic2Arn);
+ listResponse.Subscriptions.ShouldAllBe(s => s.Protocol == "sqs");
+ listResponse.Subscriptions.ShouldAllBe(s => s.Endpoint == queueArn);
}
[Fact]
@@ -483,11 +478,11 @@ await Sns.SubscribeAsync(new SubscribeRequest
}, TestContext.Current.CancellationToken);
// Assert
- listResponse.Subscriptions.Should().HaveCount(1);
- listResponse.Subscriptions.Should().Contain(s => s.SubscriptionArn == sub1.SubscriptionArn);
- listResponse.Subscriptions.Should().OnlyContain(s => s.TopicArn == topic1Arn);
- listResponse.Subscriptions.Should().OnlyContain(s => s.Protocol == "sqs");
- listResponse.Subscriptions.Should().OnlyContain(s => s.Endpoint == queueArn);
+ listResponse.Subscriptions.Count.ShouldBe(1);
+ listResponse.Subscriptions.ShouldContain(s => s.SubscriptionArn == sub1.SubscriptionArn);
+ listResponse.Subscriptions.ShouldAllBe(s => s.TopicArn == topic1Arn);
+ listResponse.Subscriptions.ShouldAllBe(s => s.Protocol == "sqs");
+ listResponse.Subscriptions.ShouldAllBe(s => s.Endpoint == queueArn);
}
[Fact]
@@ -523,12 +518,11 @@ await Sns.Paginators
.ToListAsync(cancellationToken: TestContext.Current.CancellationToken);
// Assert
- allSubscriptions.Should().HaveCount(150, "because we created 150 subscriptions");
- allSubscriptions.Should().OnlyHaveUniqueItems(s => s.SubscriptionArn);
- allSubscriptions.Where(s => s.TopicArn == topicArn).Should().HaveCount(150);
- allSubscriptions.Should().OnlyContain(s => s.Protocol == "sqs");
- allSubscriptions.Should()
- .OnlyContain(s => s.Endpoint.StartsWith($"arn:aws:sqs:us-east-1:{AccountId}:{queueNamePrefix}"));
+ allSubscriptions.Count.ShouldBe(150, "because we created 150 subscriptions");
+ Assert.Distinct(allSubscriptions.Select(s => s.SubscriptionArn));
+ allSubscriptions.Count(s => s.TopicArn == topicArn).ShouldBe(150);
+ allSubscriptions.ShouldAllBe(s => s.Protocol == "sqs");
+ allSubscriptions.ShouldAllBe(s => s.Endpoint.StartsWith($"arn:aws:sqs:us-east-1:{AccountId}:{queueNamePrefix}"));
}
protected abstract Task WaitAsync(TimeSpan delay);
@@ -594,7 +588,7 @@ public async Task PublishAsync_ToFifoTopic_ShouldDeliverMessageToFifoQueue_InOrd
MessageSystemAttributeNames = ["All"]
}, TestContext.Current.CancellationToken)).Messages;
- receivedMessages.Should().HaveCount(3, "we published 3 messages");
+ receivedMessages.Count.ShouldBe(3, "we published 3 messages");
// Detailed logging of received messages
_testOutputHelper.WriteLine("Received messages in order:");
@@ -613,15 +607,15 @@ public async Task PublishAsync_ToFifoTopic_ShouldDeliverMessageToFifoQueue_InOrd
var orderedMessages = receivedMessages
.OrderBy(m => Int128.Parse(m.Attributes["SequenceNumber"], NumberFormatInfo.InvariantInfo)).ToList();
- orderedMessages[0].Body.Should().Be("First message", "it was published first");
- orderedMessages[1].Body.Should().Be("Second message", "it was published second");
- orderedMessages[2].Body.Should().Be("Third message", "it was published third");
+ orderedMessages[0].Body.ShouldBe("First message", "it was published first");
+ orderedMessages[1].Body.ShouldBe("Second message", "it was published second");
+ orderedMessages[2].Body.ShouldBe("Third message", "it was published third");
// Verify that MessageGroupId is consistent
- receivedMessages.Should().OnlyContain(m => m.Attributes["MessageGroupId"] == messageGroupId);
+ receivedMessages.ShouldAllBe(m => m.Attributes["MessageGroupId"] == messageGroupId);
// Verify that MessageDeduplicationId is unique for each message
- receivedMessages.Select(m => m.Attributes["MessageDeduplicationId"]).Distinct().Should().HaveCount(3);
+ receivedMessages.Select(m => m.Attributes["MessageDeduplicationId"]).Distinct().Count().ShouldBe(3);
// Check if the order matches the publish order
if (receivedMessages[1].Body != "Second message" ||
@@ -672,9 +666,9 @@ public async Task PublishAsync_ToFifoTopic_ShouldPreventDuplicates()
MessageSystemAttributeNames = ["All"]
}, TestContext.Current.CancellationToken)).Messages;
- receivedMessages.Should().HaveCount(1, "because the second message should be deduplicated");
- receivedMessages[0].Body.Should().Be("Duplicate message");
- receivedMessages[0].Attributes["MessageDeduplicationId"].Should().Be(deduplicationId);
+ receivedMessages.Count.ShouldBe(1, "because the second message should be deduplicated");
+ receivedMessages[0].Body.ShouldBe("Duplicate message");
+ receivedMessages[0].Attributes["MessageDeduplicationId"].ShouldBe(deduplicationId);
}
[Fact, Trait("Category", "TimeBasedTests")]
@@ -741,18 +735,13 @@ public async Task PublishAsync_ToFifoTopic_WithMultipleMessageGroups_ShouldMaint
MessageSystemAttributeNames = ["All"]
}, TestContext.Current.CancellationToken)).Messages;
- receivedMessages.Should().HaveCount(4);
+ receivedMessages.Count.ShouldBe(4);
var groupAMessages = receivedMessages.Where(m => m.Attributes["MessageGroupId"] == "GroupA").ToList();
var groupBMessages = receivedMessages.Where(m => m.Attributes["MessageGroupId"] == "GroupB").ToList();
- groupAMessages.Select(m => m.Body).Should().BeEquivalentTo(
- ["Group A - First", "Group A - Second"],
- options => options.WithStrictOrdering());
-
- groupBMessages.Select(m => m.Body).Should().BeEquivalentTo(
- ["Group B - First", "Group B - Second"],
- options => options.WithStrictOrdering());
+ groupAMessages.Select(m => m.Body).ShouldBe(["Group A - First", "Group A - Second"]);
+ groupBMessages.Select(m => m.Body).ShouldBe(["Group B - First", "Group B - Second"]);
}
private async Task SetupFifoTopicAndQueue(string topicArn, string queueArn, bool isRawDelivery)
@@ -870,7 +859,7 @@ public async Task PublishAsync_ExactlyMaximumSize_Succeeds()
var response = await Sns.PublishAsync(request, TestContext.Current.CancellationToken);
// Assert
- response.MessageId.Should().NotBeNullOrEmpty();
+ response.MessageId.ShouldNotBeNullOrEmpty();
}
[Fact]
@@ -918,4 +907,4 @@ public async Task PublishAsync_WithSubjectAndMessageAttributes_ExceedsLimit_Thro
await Assert.ThrowsAsync(testAction);
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/LocalSqsSnsMessaging.Tests.Shared/SqsQueueTagsTests.cs b/tests/LocalSqsSnsMessaging.Tests.Shared/SqsQueueTagsTests.cs
index c799b9a..b4890e8 100644
--- a/tests/LocalSqsSnsMessaging.Tests.Shared/SqsQueueTagsTests.cs
+++ b/tests/LocalSqsSnsMessaging.Tests.Shared/SqsQueueTagsTests.cs
@@ -1,7 +1,6 @@
-using Amazon.SQS;
+using Amazon.SQS;
using Amazon.SQS.Model;
-using FluentAssertions;
-using ResourceNotFoundException = Amazon.SQS.Model.ResourceNotFoundException;
+using Shouldly;
namespace LocalSqsSnsMessaging.Tests;
@@ -10,7 +9,6 @@ public abstract class SqsQueueTagsTests
protected IAmazonSQS Sqs = null!;
protected string AccountId = null!;
private string _queueUrl = null!;
- private string _queueArn = null!;
protected abstract Task AdvanceTime(TimeSpan timeSpan);
@@ -26,7 +24,6 @@ private async Task SetupQueue()
QueueUrl = _queueUrl,
AttributeNames = ["QueueArn"]
});
- _queueArn = attrResponse.Attributes["QueueArn"];
}
[Fact]
@@ -54,7 +51,7 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().BeEquivalentTo(tags);
+ listTagsResponse.Tags.ToDictionary().ShouldBeEquivalentTo(tags);
}
[Fact]
@@ -107,9 +104,9 @@ await Sqs.UntagQueueAsync(new UntagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().HaveCount(1);
- listTagsResponse.Tags.Should().ContainKey("Cost-Center");
- listTagsResponse.Tags["Cost-Center"].Should().Be("12345");
+ listTagsResponse.Tags.Count.ShouldBe(1);
+ listTagsResponse.Tags.ShouldContainKey("Cost-Center");
+ listTagsResponse.Tags["Cost-Center"].ShouldBe("12345");
}
[Fact]
@@ -130,7 +127,7 @@ await Sqs.UntagQueueAsync(new UntagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().BeEmpty();
+ listTagsResponse.Tags.ShouldBeEmpty();
}
[Fact]
@@ -143,7 +140,7 @@ public async Task ListQueueTagsAsync_NoTags_ReturnsEmptyDictionary()
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().BeEmpty();
+ listTagsResponse.Tags.ShouldBeEmpty();
}
[Fact]
@@ -177,8 +174,8 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().HaveCount(1);
- listTagsResponse.Tags["Environment"].Should().Be("Production");
+ listTagsResponse.Tags.Count.ShouldBe(1);
+ listTagsResponse.Tags["Environment"].ShouldBe("Production");
}
[Fact]
@@ -204,8 +201,8 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().HaveCount(50);
- listTagsResponse.Tags.Should().BeEquivalentTo(tags);
+ listTagsResponse.Tags.Count.ShouldBe(50);
+ listTagsResponse.Tags.ToDictionary().ShouldBeEquivalentTo(tags);
}
[Fact]
@@ -229,8 +226,8 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().ContainKey("EmptyTag");
- listTagsResponse.Tags["EmptyTag"].Should().BeEmpty();
+ listTagsResponse.Tags.ShouldContainKey("EmptyTag");
+ listTagsResponse.Tags["EmptyTag"].ShouldBeEmpty();
}
[Fact]
@@ -254,7 +251,7 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().BeEmpty();
+ listTagsResponse.Tags.ShouldBeEmpty();
}
[Fact]
@@ -287,7 +284,7 @@ await Sqs.TagQueueAsync(new TagQueueRequest
QueueUrl = _queueUrl
}, TestContext.Current.CancellationToken);
- listTagsResponse.Tags.Should().ContainKey("TestTag");
- listTagsResponse.Tags["TestTag"].Should().BeEmpty();
+ listTagsResponse.Tags.ShouldContainKey("TestTag");
+ listTagsResponse.Tags["TestTag"].ShouldBeEmpty();
}
-}
\ No newline at end of file
+}
diff --git a/tests/LocalSqsSnsMessaging.Tests.Shared/SqsStartMessageMoveTaskAsyncTests.cs b/tests/LocalSqsSnsMessaging.Tests.Shared/SqsStartMessageMoveTaskAsyncTests.cs
index 05c04bf..4c68632 100644
--- a/tests/LocalSqsSnsMessaging.Tests.Shared/SqsStartMessageMoveTaskAsyncTests.cs
+++ b/tests/LocalSqsSnsMessaging.Tests.Shared/SqsStartMessageMoveTaskAsyncTests.cs
@@ -1,8 +1,8 @@
-using System.Text.Json;
+using System.Text.Json;
using System.Text.Json.Nodes;
using Amazon.SQS;
using Amazon.SQS.Model;
-using FluentAssertions;
+using Shouldly;
using ResourceNotFoundException = Amazon.SQS.Model.ResourceNotFoundException;
namespace LocalSqsSnsMessaging.Tests;
@@ -112,7 +112,7 @@ public async Task StartMessageMoveTaskAsync_ValidRequest_MovesMessage()
// Check that the message is now in the main queue
var mainReceiveResult = await Sqs.ReceiveMessageAsync(new ReceiveMessageRequest { QueueUrl = _mainQueueUrl, MaxNumberOfMessages = 10}, TestContext.Current.CancellationToken);
- mainReceiveResult.Messages.Should().HaveCount(4);
+ mainReceiveResult.Messages.Count.ShouldBe(4);
}
[Fact, Trait("Category", "TimeBasedTests")]
@@ -355,4 +355,4 @@ await Sqs.SetQueueAttributesAsync(new SetQueueAttributesRequest
Assert.Equal(_mainQueueArn, task1Info.DestinationArn);
Assert.Equal(10, task1Info.MaxNumberOfMessagesPerSecond);
}
-}
\ No newline at end of file
+}
diff --git a/tests/LocalSqsSnsMessaging.Tests.Verification/LocalSqsSnsMessaging.Tests.Verification.csproj b/tests/LocalSqsSnsMessaging.Tests.Verification/LocalSqsSnsMessaging.Tests.Verification.csproj
index 0f6a564..5ff6f3f 100644
--- a/tests/LocalSqsSnsMessaging.Tests.Verification/LocalSqsSnsMessaging.Tests.Verification.csproj
+++ b/tests/LocalSqsSnsMessaging.Tests.Verification/LocalSqsSnsMessaging.Tests.Verification.csproj
@@ -1,25 +1,25 @@
- net8.0
- enable
- enable
- false
- true
- $(NoWarn);CA2007
+ net8.0
+ enable
+ enable
+ false
+ true
+ $(NoWarn);CA2007
-
-
-
-
+
+
+
+
-
-
-
+
+
+
diff --git a/tests/LocalSqsSnsMessaging.Tests/LocalSqsSnsMessaging.Tests.csproj b/tests/LocalSqsSnsMessaging.Tests/LocalSqsSnsMessaging.Tests.csproj
index 19160a2..8232359 100644
--- a/tests/LocalSqsSnsMessaging.Tests/LocalSqsSnsMessaging.Tests.csproj
+++ b/tests/LocalSqsSnsMessaging.Tests/LocalSqsSnsMessaging.Tests.csproj
@@ -1,26 +1,26 @@
- net8.0
- enable
- enable
- false
- true
- $(NoWarn);CA1051;CA2007;CA1707
+ net8.0
+ enable
+ enable
+ false
+ true
+ $(NoWarn);CA1051;CA2007;CA1707
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+