I'm new to unit testing and mocking. I have to convert unit tests in my current project with using Moq. Currently tests are using Nmock2. Can you help me with 开发者_高级运维converting this code (using of CollectAction) with using Moq:
Action<IScanFolder> publish;
Mockery mocks = new Mockery();
this.mockChannel= mocks.NewMock<IChannel>();
...
CollectAction collect = new CollectAction(1);
Expect.Once.On(mockChannel).Method("Subscribe").
    With(p1, NMock2.Is.NotNull).
    Will(collect);
...
mocks.VerifyAllExpectationsHaveBeenMet();
publish = collect.Parameter as Action<ISomeInterface>;
Thanks in advance.
Callback is Moq's CollectAction:
Action<ISomeInterface> publish;    
mockChannel.Setup(c => c.Subscribe(p1, It.IsAny<TArg2>())).Callback((arg1, arg2) => publish = arg2)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论