User Tools

Site Tools


technical_notes:public:20130930-mstest-how-mock-async

Parent

TFS - How to mock async methods with Mstests ?

We will force the callback to be called with our own arguments.

StringManager vm = new StringManager();
 
string input = "750";
List<string> results = new List<string>()
    {
        "test",
        "test",
    };
 
this.cachedString.Setup((str) => str.GetStringAsync(input, 
    vm.Callback_SuggererString)).Callback(() => vm.Callback_SuggererString(results));
technical_notes/public/20130930-mstest-how-mock-async.txt · Last modified: 2013/10/06 18:44 by Fabien Arcellier