我有空隙法:cmd
设置变量名
this._dispatcher.PushAsync(handler, cmd);
执行后,我已经改变了性质:
cmd.Result = userId;
如何设置后执行无效方法属性值在单元测试中?
我想类似的东西:
_dispatcher = new Mock<IDispatcher>();
_a = new Mock<SaveUserCmd>();
_dispatcher
.Setup(r => r.PushAsync(_cmdHandler, this._cmd))
.Callback(() => _a.SetupProperty(y => y.Result == this._response));
但它表明...
(Error: Expression is not a property access:
y => y.Result == this._response
).
SaveUserCmd:
public class SaveUserCmd
{
public string FirstName { get; set; }
public string LastName { get; set; }
public object Result { get; set; }
}
IDispatcher:
public interface IDispatcher
{
Task PushAsync<TCommand>(ICommandHandlerAsync<TCommand> commandHandlerAsync, TCommand message);
}
“是”是什么意思?有什么异常?意外的行为? – HimBromBeere