{"action":"created","issue":{"url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/6","repository_url":"https://api.github.com/repos/MortenChristiansen/Overflow.net","labels_url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/6/comments","events_url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/6/events","html_url":"https://github.com/MortenChristiansen/Overflow.net/issues/6","id":149152349,"number":6,"title":"How to mock child operations in tests","user":{"login":"alexandru-calinoiu","id":679198,"avatar_url":"https://avatars.githubusercontent.com/u/679198?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandru-calinoiu","html_url":"https://github.com/alexandru-calinoiu","followers_url":"https://api.github.com/users/alexandru-calinoiu/followers","following_url":"https://api.github.com/users/alexandru-calinoiu/following{/other_user}","gists_url":"https://api.github.com/users/alexandru-calinoiu/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandru-calinoiu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandru-calinoiu/subscriptions","organizations_url":"https://api.github.com/users/alexandru-calinoiu/orgs","repos_url":"https://api.github.com/users/alexandru-calinoiu/repos","events_url":"https://api.github.com/users/alexandru-calinoiu/events{/privacy}","received_events_url":"https://api.github.com/users/alexandru-calinoiu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-18T13:35:34Z","updated_at":"2016-04-19T21:41:43Z","closed_at":null,"body":"I have an Operation that depends on a couple child operations, I would like to mock their output in my tests, what will be the best way to achieve this?"},"comment":{"url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/comments/212141279","html_url":"https://github.com/MortenChristiansen/Overflow.net/issues/6#issuecomment-212141279","issue_url":"https://api.github.com/repos/MortenChristiansen/Overflow.net/issues/6","id":212141279,"user":{"login":"MortenChristiansen","id":238240,"avatar_url":"https://avatars.githubusercontent.com/u/238240?v=3","gravatar_id":"","url":"https://api.github.com/users/MortenChristiansen","html_url":"https://github.com/MortenChristiansen","followers_url":"https://api.github.com/users/MortenChristiansen/followers","following_url":"https://api.github.com/users/MortenChristiansen/following{/other_user}","gists_url":"https://api.github.com/users/MortenChristiansen/gists{/gist_id}","starred_url":"https://api.github.com/users/MortenChristiansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MortenChristiansen/subscriptions","organizations_url":"https://api.github.com/users/MortenChristiansen/orgs","repos_url":"https://api.github.com/users/MortenChristiansen/repos","events_url":"https://api.github.com/users/MortenChristiansen/events{/privacy}","received_events_url":"https://api.github.com/users/MortenChristiansen/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T21:41:43Z","updated_at":"2016-04-19T21:41:43Z","body":"An approach might be to create a custom `IOperationResolver` rather than using the built in `SimpleOperationResolver`. If you use interfaces for your operations, the new resolver could look for mock implementations to return instead. Just copy the build in implementation and replace the logic that instantiates operations using `Activator.CreateInstance(...)`. Each operation interface would have to implement the `IOperation` interface but would not need to have any members itself, unless needed by the test. I think that should do it. If you try it, let me know how it goes. Otherwise, I might give it a go later this week."}}