Esempio n. 1
0
        public async Task GetMaximumSequenceNumberCommand_ValidCommand_ReturnsNumber()
        {
            // Arrange
            await using var host = await MarketOperatorIntegrationTestHost
                                   .InitializeAsync()
                                   .ConfigureAwait(false);

            await using var scope = host.BeginScope();
            var mediator = scope.GetInstance <IMediator>();

            var command = new GetMaximumSequenceNumberCommand();

            // Act
            var actual = await mediator.Send(command).ConfigureAwait(false);

            // Assert
            Assert.True(actual >= 0);
        }
        public async Task GetHandle_SequenceNumber_IsReturned()
        {
            // Arrange
            const long expected = 170989;

            var repository = new Mock <ISequenceNumberRepository>();

            repository.Setup(x => x.GetMaximumSequenceNumberAsync())
            .ReturnsAsync(new SequenceNumber(expected));

            var target = new MaximumSequenceNumberCommandHandler(repository.Object);

            // Act
            var command = new GetMaximumSequenceNumberCommand();
            var actual  = await target.Handle(command, CancellationToken.None).ConfigureAwait(false);

            // Assert
            Assert.Equal(expected, actual);
        }