public void ReplaceMeWithRealTests() { /* * This test is for illustrative purposes, to show the interfaces a typical asynchronous generic policy fulfills. * Real tests should check policy behaviour. */ AsyncReactiveFooPolicy <int> policy = Policy <int> .Handle <Exception>().AsyncReactiveFoo(); policy.Should().BeAssignableTo <IAsyncPolicy <int> >(); policy.Should().BeAssignableTo <IReactiveFooPolicy <int> >(); }
public async Task PolicyExecutesThePassedDelegate() { bool executed = false; AsyncReactiveFooPolicy <int> policy = Policy <int> .Handle <Exception>().AsyncReactiveFoo(); await policy.ExecuteAsync(() => { executed = true; return(Task.FromResult(0)); }); executed.Should().BeTrue(); }