dimanche 29 mai 2016

how to write unit test workflow foundation?

I have started working with workflow foundations. i have to write unit test for below code is possible to mock interface that is passed as an inargument.

IExecutorApp myApp;

        public InArgument<IApp1> InArgument1;

        public InArgument<IApp2> InArgument2;

        public InArgument<IApp3> InArgument3;

protected override bool CanInduceIdle
        {
            get
            {
                return true;
            }
        }

protected override void Execute(NativeActivityContext context)
        {
            IApp1 = myApp.Get(context);

            if (IApp1 == null)
            {
                throw new ArgumentNullException("context");
            }
            IApp1.App = InArgument2.Get(context);

            IApp1.InitializeApp();

            IApp1.LoadApp(InArgument3.Get(context));

            IApp1.StartApp();

            context.CreateBookmark("SyncBookmark", OnAppCompleted);

        }
         private void OnScanCompleted(NativeActivityContext context, Bookmark bookmark, object value)
        {

            context.ResumeBookmark(bookmark, string.Empty);

        }

How to write unit test for above code

Aucun commentaire:

Enregistrer un commentaire