public void Lock_should_set_lockId_and_date() { var sut = OutboxMessage.New(Guid.NewGuid(), null, "lorem", Guid.NewGuid()); sut.Lock(); sut.LockId.Should().NotBeNull(); sut.LockTime.Should().NotBeNull(); }
private async Task AppendAsyncCore(IMessage message, CancellationToken cancellationToken) { var serialized = await _serializer.SerializeAsync(message, cancellationToken); var entity = OutboxMessage.New(message.Id, serialized, message.GetType().FullName, message.CorrelationId); _dbContext.OutboxMessages.Add(entity); await _dbContext.SaveChangesAsync(cancellationToken) .ConfigureAwait(false); }
public void Release_should_release_lock() { var sut = OutboxMessage.New(Guid.NewGuid(), null, "lorem", Guid.NewGuid()); sut.Release(); sut.Status.Should().Be(OutboxMessage.MessageStatuses.Processed); sut.PublishingDate.Should().NotBeNull(); sut.LockId.Should().BeNull(); sut.LockTime.Should().BeNull(); }
public void New_should_create_valid_instance() { var expectedId = Guid.NewGuid(); var expectedType = "lorem"; ReadOnlyMemory <byte> expectedData = new byte[] { 1, 2, 3, 4 }; var expectedCorrelationId = Guid.NewGuid(); var sut = OutboxMessage.New(expectedId, expectedData, expectedType, expectedCorrelationId); sut.Id.Should().Be(expectedId); sut.Data.Should().BeEquivalentTo(expectedData); sut.Type.Should().Be(expectedType); sut.Status.Should().Be(OutboxMessage.MessageStatuses.Pending); sut.PartitionKey.Should().Be(expectedCorrelationId.ToString()); sut.PublishingDate.Should().BeNull(); sut.LockId.Should().BeNull(); sut.LockTime.Should().BeNull(); }