public void ReturnsAnonymousForAnonymousActionWhenDescribing() { var testee = new ArgumentLessActionHolder(() => { }); var description = testee.Describe(); description .Should() .Be("anonymous"); }
public void ReturnsFunctionNameForNonAnonymousActionWhenDescribing() { var testee = new ArgumentLessActionHolder(Action); var description = testee.Describe(); description .Should() .Be("Action"); }
public void ActionIsInvokedWhenActionHolderIsExecuted() { var wasExecuted = false; void AnAction() => wasExecuted = true; var testee = new ArgumentLessActionHolder(AnAction); testee.Execute(null); wasExecuted .Should() .BeTrue(); }
public async Task SyncActionIsInvokedWhenActionHolderIsExecuted() { var wasExecuted = false; void SyncAction() => wasExecuted = true; var testee = new ArgumentLessActionHolder(SyncAction); await testee.Execute(null); wasExecuted .Should() .BeTrue(); }
public async Task AsyncActionIsInvokedWhenActionHolderIsExecuted() { var wasExecuted = false; Task AsyncAction() { wasExecuted = true; return(Task.CompletedTask); } var testee = new ArgumentLessActionHolder(AsyncAction); await testee.Execute(null); wasExecuted .Should() .BeTrue(); }