我有空隙法: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