public void AggregateSagaIdentityExtractor_InValidObject_ThrowsArgumentNullException() { DomainEvent <TestAggregate, TestAggregateId, TestSentEvent> message = null; var shardResolver = new ShardResolvers(10); // ReSharper disable once ExpressionIsAlwaysNull this.Invoking(test => shardResolver.AggregateSagaShardResolver <TestSagaManager, TestSaga, TestSagaId, TestSagaLocator>(message)) .Should().Throw <ArgumentNullException>(); }
public void AggregateSagaIdentityExtractor_InValidObject_ThrowsArgumentException() { var message = string.Empty; var shardResolver = new ShardResolvers(10); this.Invoking(test => shardResolver.AggregateSagaShardResolver <TestSagaManager, TestSaga, TestSagaId, TestSagaLocator>(message)) .Should().Throw <ArgumentException>() .WithMessage(nameof(message)); }
public void AggregateSagaIdentityExtractor_ValidMessage_ExtractsShardValue(int shardSize) { var aggregateId = TestAggregateId.New; var receiverId = TestAggregateId.New; var testId = TestId.New; var test = new Test(testId); var now = DateTimeOffset.UtcNow; var aggregateSequenceNumber = 3; var message = new DomainEvent <TestAggregate, TestAggregateId, TestSentEvent>( aggregateId, new TestSentEvent(test, receiverId), new Metadata(), now, aggregateSequenceNumber); var shardResolver = new ShardResolvers(shardSize); var extractedShard = shardResolver.AggregateSagaShardResolver <TestSagaManager, TestSaga, TestSagaId, TestSagaLocator>(message); var extractedShardValue = int.Parse(extractedShard); extractedShardValue.Should().BeInRange(0, shardSize); }