public void NonMatchingType() { var testee = new ArgumentActionHolder <IBase>(BaseAction); Action action = () => testee.Execute(3); action.Should().Throw <ArgumentException>(); }
public void TooManyArguments() { var testee = new ArgumentActionHolder <IBase>(BaseAction); Action action = () => testee.Execute(new object[] { 3, 4 }); action.Should().Throw <ArgumentException>(); }
public void TooFewArguments() { var testee = new ArgumentActionHolder<IBase>(BaseAction); Action action = () => { testee.Execute(new object[] { }); }; action.ShouldThrow<ArgumentException>(); }
public void TooFewArguments() { var testee = new ArgumentActionHolder <IBase>(BaseAction); Func <Task> action = async() => await testee.Execute(new object[] { }); action.Should().Throw <ArgumentException>(); }
public void NonMatchingType() { var testee = new ArgumentActionHolder<IBase>(BaseAction); Action action = () => { testee.Execute(3); }; action.ShouldThrow<ArgumentException>(); }
public void NonMatchingType() { var testee = new ArgumentActionHolder <IBase>(BaseAction); Func <Task> action = async() => await testee.Execute(3); action.Should().Throw <ArgumentException>(); }
public void ReturnsAnonymousForAnonymousActionWhenDescribing() { var testee = new ArgumentActionHolder <MyArgument>(a => { }); var description = testee.Describe(); description .Should() .Be("anonymous"); }
public void ReturnsFunctionNameForNonAnonymousActionWhenDescribing() { var testee = new ArgumentActionHolder <MyArgument>(Action); var description = testee.Describe(); description .Should() .Be("Action"); }
public void ActionIsInvokedWithSameArgumentThatIsPassedToActionHolderExecuted() { var expected = new MyArgument(); MyArgument value = null; void AnAction(MyArgument x) => value = x; var testee = new ArgumentActionHolder <MyArgument>(AnAction); testee.Execute(expected); value.Should().Be(expected); }
public async Task AsyncActionIsInvokedWithSameArgumentThatIsPassedToActionHolderExecuted() { var expected = new MyArgument(); MyArgument value = null; Task AsyncAction(MyArgument x) { value = x; return(Task.CompletedTask); } var testee = new ArgumentActionHolder <MyArgument>(AsyncAction); await testee.Execute(expected); value.Should().Be(expected); }
public void DerivedType() { var testee = new ArgumentActionHolder <IBase>(BaseAction); testee.Execute(A.Fake <IDerived>()); }
public void MatchingType() { var testee = new ArgumentActionHolder <IBase>(BaseAction); testee.Execute(A.Fake <IBase>()); }
public void DerivedType() { var testee = new ArgumentActionHolder<IBase>(BaseAction); testee.Execute(A.Fake<IDerived>()); }
public void MatchingType() { var testee = new ArgumentActionHolder<IBase>(BaseAction); testee.Execute(A.Fake<IBase>()); }
public async Task DerivedType() { var testee = new ArgumentActionHolder <IBase>(BaseAction); await testee.Execute(A.Fake <IDerived>()); }