Example #1
0
        public async Task <bool> WriteToResponseAsync(StubModel stub, ResponseModel response)
        {
            // Simulate sluggish response here, if configured.
            if (stub.Response?.ExtraDuration.HasValue != true)
            {
                return(false);
            }

            var duration = stub.Response.ExtraDuration.Value;
            await _asyncService.DelayAsync(duration);

            return(true);
        }
    /// <inheritdoc />
    public async Task <StubResponseWriterResultModel> WriteToResponseAsync(StubModel stub, ResponseModel response)
    {
        // Simulate sluggish response here, if configured.
        if (stub.Response?.ExtraDuration.HasValue != true)
        {
            return(StubResponseWriterResultModel.IsNotExecuted(GetType().Name));
        }

        var duration = stub.Response.ExtraDuration.Value;
        await _asyncService.DelayAsync(duration);

        return(StubResponseWriterResultModel.IsExecuted(GetType().Name));
    }