botframework - Setup UserData for unit testing -


how setup userdata within context unit testing?

        var context = new mock<idialogcontext>();         context.setup(c => c.activity).returns(() => new activity());         context.setup(c => c.userdata).returns(() => ?); 

should use botdata?

used "dialogtestbase" class botbuilder tests , worked me.

        ibotdatabag databag;         var container = build(options.lastwritewinscachingbotdatastore);         var msg = maketestmessage();         using (var scope = dialogmodule.beginlifetimescope(container, msg))         {             var botdata = scope.resolve<ibotdata>();             await botdata.loadasync(default(cancellationtoken));             databag = scope.resolve<func<ibotdatabag>>()();         }          var context = new mock<idialogcontext>();         context.setup(c => c.userdata).returns(() => databag);         context.object.userdata.setvalue(appconstants.helptype, helptype); 

Comments