public EdgeCaseController(IEdgeCaseService service) => Service = service;
public EdgeCaseRewriteController(IEdgeCaseService service) : base(service) { }
private async Task ActualTest(IEdgeCaseService service) { var error = (Exception?)null; await service.SetSuffix(""); (await service.GetSuffix()).Should().Be(""); // ThrowIfContainsErrorAsync method test var c1 = await Computed.Capture( ct => service.ThrowIfContainsError("a", ct)); c1.Value.Should().Be("a"); var c2 = await Computed.Capture( ct => service.ThrowIfContainsError("error", ct)); c2.Error !.GetType().Should().Be(ThrowIfContainsErrorExceptionType); c2.Error.Message.Should().Be("!"); await service.SetSuffix("z"); c1 = await Update(c1); c1.Value.Should().Be("az"); c2 = await Update(c2); c2.Error !.GetType().Should().Be(ThrowIfContainsErrorExceptionType); c2.Error.Message.Should().Be("!"); await service.SetSuffix(""); // ThrowIfContainsErrorRewriteErrorsAsync method test c1 = await Computed.Capture( ct => service.ThrowIfContainsErrorRewriteErrors("a", ct)); c1.Value.Should().Be("a"); c2 = await Computed.Capture( ct => service.ThrowIfContainsErrorRewriteErrors("error", ct)); c2.Error !.GetType().Should().Be(ThrowIfContainsErrorRewriteErrorsExceptionType); c2.Error.Message.Should().Be("!"); await service.SetSuffix("z"); c1 = await Update(c1); c1.Value.Should().Be("az"); c2 = await Update(c2); c2.Error !.GetType().Should().Be(ThrowIfContainsErrorRewriteErrorsExceptionType); c2.Error.Message.Should().Be("!"); await service.SetSuffix(""); // ThrowIfContainsErrorRewriteErrorsAsync method test (await service.ThrowIfContainsErrorNonCompute("a")).Should().Be("a"); try { await service.ThrowIfContainsErrorNonCompute("error"); } catch (Exception e) { error = e; } error !.GetType().Should().Be(ThrowIfContainsErrorNonComputeExceptionType); error.Message.Should().Be("!"); await service.SetSuffix("z"); (await service.ThrowIfContainsErrorNonCompute("a")).Should().Be("az"); try { await service.ThrowIfContainsErrorNonCompute("error"); } catch (Exception e) { error = e; } error !.GetType().Should().Be(ThrowIfContainsErrorNonComputeExceptionType); error.Message.Should().Be("!"); await service.SetSuffix(""); }