Exemplo n.º 1
0
        public async Task StartAsync_ShouldBe_Origin_StartAsync()
        {
            // Arrange
            var expected          = Result.Ok();
            var cancellationToken = new CancellationToken();

            _origin.StartAsync(cancellationToken).Returns(expected);
            _retryPolicy
            .ExecuteAsync(Arg.Any <Func <CancellationToken, Task <Result> > >(), Arg.Any <CancellationToken>())
            .Returns(args => args.Arg <Func <CancellationToken, Task <Result> > >()(cancellationToken));
            var subject = new ReliableService(_retryPolicy, _origin);

            // Act
            var result = await subject.StartAsync(cancellationToken);

            // Assert
            result.Should().BeSameAs(expected);
        }
Exemplo n.º 2
0
 public Task <Result> StartAsync(CancellationToken cancellationToken)
 {
     return(_retryPolicy.ExecuteAsync(ct => _origin.StartAsync(ct), cancellationToken));
 }