public async Task WithPolicy() { var impl = new Throw(); var provider = new NoOpPolicyProvider(); var proxy = PollyWrapper <IThrow> .Decorate(impl, provider, new ContextProvider()); await Assert.ThrowsAsync <ApplicationException>(async() => await proxy.ThrowException()); }
public void WithPolicy() { var impl = new Throw(); var provider = new NoOpPolicyProvider(); var proxy = PollyWrapper <IThrow> .Decorate(impl, provider, new ContextProvider()); Assert.Throws <ApplicationException>(() => proxy.ThrowException()); }
public void WithPolicy() { var impl = new Service(); var provider = new NoOpPolicyProvider(); var proxy = PollyWrapper <IService> .Decorate(impl, provider, new ContextProvider()); var result = proxy.Echo(HelloWorld); result.ShouldBe(HelloWorld); }
public void WithPolicy() { var output = new StringWriter(); var impl = new Service(output); var provider = new NoOpPolicyProvider(); var proxy = PollyWrapper <IService> .Decorate(impl, provider, new ContextProvider()); proxy.Say(HelloWorld); output.ToString().ShouldBe(HelloWorld); }
public async Task WithPolicy() { var impl = new Service(); var provider = new NoOpPolicyProvider(); var proxy = PollyWrapper <IService <string> > .Decorate(impl, provider, new ContextProvider()); var result = await proxy.EchoAsync(HelloWorld); result.ShouldBe(HelloWorld); }