public void OperationShouldSerializeAsyncMethodWithViewModel()
        {
            var vmMock = new NavigableViewModelMock();

            ServiceProvider.OperationCallbackFactory = new SerializableOperationCallbackFactory();
            var operation = new AsyncOperation <bool>();
            IOperationResult <bool> result = OperationResult.CreateResult(OperationType.PageNavigation, this, true,
                                                                          new NavigationContext(NavigationType.Page, NavigationMode.Back, vmMock, vmMock, this));

            AsyncMethodWithViewModel(operation, true, vmMock);
            var callback  = operation.ToOperationCallback();
            var serialize = Serializer.Serialize(callback);

            serialize.Position = 0;
            callback           = (IOperationCallback)Serializer.Deserialize(serialize);

            IocContainer.GetFunc = (type, s, arg3) =>
            {
                if (type == GetType())
                {
                    return(this);
                }
                return(Activator.CreateInstance(type));
            };
            AsyncMethodInvoked.ShouldBeFalse();
            ViewModel.ShouldBeNull();
            callback.Invoke(result);
            AsyncMethodInvoked.ShouldBeTrue();
            ViewModel.ShouldEqual(vmMock);
        }
        public void OperationShouldSerializeAsyncMethod()
        {
            ServiceProvider.OperationCallbackFactory = new SerializableOperationCallbackFactory();
            var operation = new AsyncOperation <bool>();
            IOperationResult <bool> result = OperationResult.CreateResult(OperationType.PageNavigation, this, true);

            AsyncMethod(operation, true);
            var callback  = operation.ToOperationCallback();
            var serialize = Serializer.Serialize(callback);

            serialize.Position = 0;
            callback           = (IOperationCallback)Serializer.Deserialize(serialize);

            IocContainer.GetFunc = (type, s, arg3) =>
            {
                if (type == this.GetType())
                {
                    return(this);
                }
                return(Activator.CreateInstance(type));
            };
            AsyncMethodInvoked.ShouldBeFalse();
            callback.Invoke(result);
            AsyncMethodInvoked.ShouldBeTrue();
        }