问题描述
给定以下类,我如何测试在调用 MethodUnderTest
时调用了 GetSomething
?
public class SystemUnderTest
{
private Foo foo;
public string MethodUnderTest(int input)
{
return foo.Get(x => x.GetSomething(input));
}
}
测试
public void VerifyGetSomethingInvokedWhenMethodUnderTestIsInvoked()
{
//Arrange
var sut = new SystemUnderTest();
//Act
string unusedResult = sut.MethodUnderTest(5);
//Assert
A.CallTo(()=> sut.MethodUnderTest(A<int>.Ignored)) //Cant figure out how to test the Func<T> invocation
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)