コード例 #1
0
        public async Task FiringSignInCommand_Persists_Credentials_And_Turns_Invisible()
        {
            bool accountServiceSignInCalled = false;
            bool flyoutClosed = false;

            var accountService = new MockAccountService()
                {
                    SignInUserAsyncDelegate = (username, password, useCredentialStore) =>
                        {
                            Assert.AreEqual("TestUsername", username);
                            Assert.AreEqual("TestPassword", password);
                            Assert.IsTrue(useCredentialStore);
                            accountServiceSignInCalled = true;
                            return Task.FromResult(true);
                        }
                };

            var target = new SignInFlyoutViewModel(accountService, null, null)
                {
                    CloseFlyout = () => flyoutClosed = true,
                    UserName = "******",
                    Password = "******",
                    SaveCredentials = true
                };

            await target.SignInCommand.Execute();

            Assert.IsTrue(accountServiceSignInCalled);
            Assert.IsTrue(flyoutClosed);
        }
        public async Task SignOut_CallsSignOutinAccountServiceAndRemovesSavedCredentials()
        {
            bool closeFlyoutCalled = false;
            bool accountServiceSignOutCalled = false;
            bool clearHistoryCalled = false;
            bool navigateCalled = false;

            var accountService = new MockAccountService
                {
                    SignOutDelegate = () => accountServiceSignOutCalled = true,
                    VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult(new UserInfo())
                };

            var navigationService = new MockNavigationService
                {
                    ClearHistoryDelegate = () => clearHistoryCalled = true,
                    NavigateDelegate = (s, o) =>
                        {
                            navigateCalled = true;
                            Assert.AreEqual("Hub", s);
                            return true;
                        }
                };

            var target = new SignOutFlyoutViewModel(accountService, navigationService) { CloseFlyout = () => closeFlyoutCalled = true };

            await target.SignOutCommand.Execute();

            Assert.IsTrue(accountServiceSignOutCalled);
            Assert.IsTrue(closeFlyoutCalled);
            Assert.IsTrue(clearHistoryCalled);
            Assert.IsTrue(navigateCalled);
        }
        public void VMListensToShoppingCartUpdatedEvent_ThenCalculatesTotalNumberOfItemsInCart()
        {
            var shoppingCart = new ShoppingCart(new List<ShoppingCartItem>());
            var shoppingCartRepository = new MockShoppingCartRepository();

            shoppingCartRepository.GetShoppingCartAsyncDelegate = () => Task.FromResult(shoppingCart);
            var shoppingCartUpdatedEvent = new ShoppingCartUpdatedEvent();
            var eventAggregator = new MockEventAggregator();
            eventAggregator.GetEventDelegate = type =>
            {
                if (type == typeof(ShoppingCartUpdatedEvent)) return shoppingCartUpdatedEvent;
                if (type == typeof(ShoppingCartItemUpdatedEvent)) return new ShoppingCartItemUpdatedEvent();
                return null;
            };
            var accountService = new MockAccountService();
            accountService.VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult((UserInfo)null);
            var target = new ShoppingCartTabUserControlViewModel(shoppingCartRepository, eventAggregator, null, null, accountService);

            shoppingCart = new ShoppingCart(new List<ShoppingCartItem>()
                                               {
                                                   new ShoppingCartItem {Quantity = 1},
                                                   new ShoppingCartItem {Quantity = 2}
                                               });

            Assert.AreEqual(0, target.ItemCount);

            shoppingCartUpdatedEvent.Publish(null);

            Assert.AreEqual(3, target.ItemCount);

        }
        public async Task ExecuteGoNextCommand_ProcessesFormsAndNavigates_IfViewModelsAreValid()
        {
            bool shippingInfoProcessed = false;
            bool billingInfoProcessed = false;
            bool paymentInfoProcessed = false;
            bool navigated = false;
            var shippingAddressPageViewModel = new MockShippingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = () =>
                                                   {
                                                       shippingInfoProcessed = true;
                                                       return Task.Delay(0);
                                                   }
                };
            var billingAddressPageViewModel = new MockBillingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = () =>
                                                   {
                                                       billingInfoProcessed = true;
                                                       return Task.Delay(0);
                                                   }
                };
            var paymentMethodPageViewModel = new MockPaymentMethodPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = async () => 
                        {
                            paymentInfoProcessed = true;
                            await Task.Delay(0);
                        }
                };
            var accountService = new MockAccountService()
                {
                    VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult(new UserInfo()),
                    SignedInUser = new UserInfo() { UserName = "******" }
                };
            var orderRepository = new MockOrderRepository()
                {
                    CreateBasicOrderAsyncDelegate = (a, b, c, d, e) => Task.FromResult(new Order() { Id = 1 })
                };
            var shoppingCartRepository = new MockShoppingCartRepository()
                {
                    GetShoppingCartAsyncDelegate = () => Task.FromResult(new ShoppingCart(null))
                };
            var navigationService = new MockNavigationService()
                {
                    NavigateDelegate = (a, b) => navigated = true
                };

            var target = new CheckoutHubPageViewModel(navigationService, accountService, orderRepository, shoppingCartRepository,
                                            shippingAddressPageViewModel, billingAddressPageViewModel, paymentMethodPageViewModel, null, null);
            await target.GoNextCommand.Execute();

            Assert.IsTrue(shippingInfoProcessed);
            Assert.IsTrue(billingInfoProcessed);
            Assert.IsTrue(paymentInfoProcessed);
            Assert.IsTrue(navigated);
        }
コード例 #5
0
        public void UserName_ReturnsLastSignedInUser_IfAvailable()
        {
            var accountService = new MockAccountService()
                {
                    SignedInUser = new UserInfo { UserName = "******" }
                };

            var target = new SignInFlyoutViewModel(accountService, null, null);

            Assert.AreEqual("TestUserName", target.UserName);
            Assert.IsFalse(target.IsNewSignIn);
        }
コード例 #6
0
        public async Task FiringSignInCommand_WithNotRememberPassword_DoesNotSaveInCredentialStore()
        {
            var accountService = new MockAccountService()
                {
                    SignInUserAsyncDelegate = (username, password, useCredentialStore) =>
                        {
                            Assert.IsFalse(useCredentialStore);
                            return Task.FromResult(true);
                        }
                };

            var target = new SignInFlyoutViewModel(accountService, null, null)
                {
                    CloseFlyout = () => Assert.IsTrue(true),
                    SaveCredentials = false
                };

            await target.SignInCommand.Execute();
        }
        public async Task SubmitInvalidOrder_CallsErrorDialog()
        {
            bool successDialogCalled = false;
            bool errorDialogCalled = false;
            var navigationService = new MockNavigationService();
            var accountService = new MockAccountService()
                {
                    VerifySavedCredentialsAsyncDelegate = () => Task.FromResult<UserInfo>(new UserInfo())
                };
            var orderService = new MockOrderService()
                {
                    // the order is invalid, it cannot be processed
                    ProcessOrderAsyncDelegate = (o) =>
                        {
                            var modelValidationResult = new ModelValidationResult();
                            modelValidationResult.ModelState.Add("someKey", new List<string>() { "the value of someKey is invalid" });
                            throw new ModelValidationException(modelValidationResult);
                        }
                };
            var resourcesService = new MockResourceLoader()
                {
                    GetStringDelegate = (key) => key
                };
            var alertService = new MockAlertMessageService()
                {
                    ShowAsyncDelegate = (dialogTitle, dialogMessage) =>
        {
                        successDialogCalled = dialogTitle.ToLower().Contains("purchased");
                        errorDialogCalled = !successDialogCalled;
                        return Task.FromResult(successDialogCalled);
                    }
                };

            var target = new CheckoutSummaryPageViewModel(navigationService, orderService, null, null, null, null, accountService, resourcesService, alertService, null);
            await target.SubmitCommand.Execute();

            Assert.IsFalse(successDialogCalled);
            Assert.IsTrue(errorDialogCalled);
        }
        public async Task SubmitValidOrder_NavigatesToOrderConfirmation()
        {
            bool navigateCalled = false;
            bool clearCartCalled = false;
            var navigationService = new MockNavigationService();
            navigationService.NavigateDelegate = (s, o) =>
                                                     {
                                                         Assert.AreEqual("OrderConfirmation", s);
                                                         navigateCalled = true;
                                                         return true;
                                                     };
            
            var accountService = new MockAccountService()
                {
                    VerifySavedCredentialsAsyncDelegate = () => Task.FromResult<UserInfo>(new UserInfo())
                };
            var orderService = new MockOrderService()
                {
                    // the order is valid, it can be processed
                    ProcessOrderAsyncDelegate = (o) => Task.FromResult(true)
                };
            var resourcesService = new MockResourceLoader()
                {
                    GetStringDelegate = (key) => key
                };
            var shoppingCartRepository = new MockShoppingCartRepository();
            shoppingCartRepository.ClearCartAsyncDelegate = () =>
                                                                {
                                                                    clearCartCalled = true;
                                                                    return Task.Delay(0);
                                                                };
            var target = new CheckoutSummaryPageViewModel(navigationService, orderService, null, null, null, shoppingCartRepository, accountService, resourcesService, null, null);
            await target.SubmitCommand.Execute();

            Assert.IsTrue(navigateCalled);
            Assert.IsTrue(clearCartCalled);
        }
        public void ShoppingCartUpdated_WithNullCart_SetsItemCountZero()
        {
            var shoppingCartRepository = new MockShoppingCartRepository();
            var shoppingCart = new ShoppingCart(new List<ShoppingCartItem> {new ShoppingCartItem {Quantity = 99}});
            shoppingCartRepository.GetShoppingCartAsyncDelegate = () => Task.FromResult(shoppingCart);
            var eventAggregator = new MockEventAggregator();
            var shoppingCartUpdatedEvent = new ShoppingCartUpdatedEvent();
            eventAggregator.GetEventDelegate = type =>
            {
                if (type == typeof(ShoppingCartUpdatedEvent)) return shoppingCartUpdatedEvent;
                if (type == typeof(ShoppingCartItemUpdatedEvent)) return new ShoppingCartItemUpdatedEvent();
                return null;
            };
            var accountService = new MockAccountService();
            accountService.VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult((UserInfo)null);
            var target = new ShoppingCartTabUserControlViewModel(shoppingCartRepository, eventAggregator, null, null, accountService);

            shoppingCartUpdatedEvent.Publish(null);

            Assert.AreEqual(99, target.ItemCount);

            shoppingCartRepository.GetShoppingCartAsyncDelegate = () => Task.FromResult<ShoppingCart>(null);
            shoppingCartUpdatedEvent.Publish(null);

            Assert.AreEqual(0, target.ItemCount);
        }
コード例 #10
0
        public async Task CachedAddressesAndPaymentMethodsExpire_WhenUserChanged()
        {
            var accountService = new MockAccountService();
            var target = new CheckoutDataRepository(SetupAddressService(), SetupPaymentMethodService(), accountService);

            var paymentMethods = await target.GetAllPaymentMethodsAsync();

            Assert.AreSame(await target.GetAllPaymentMethodsAsync(), paymentMethods, "Cached data should be same.");

            accountService.RaiseUserChanged(null, null);

            Assert.AreNotSame(await target.GetAllPaymentMethodsAsync(), paymentMethods);
        }
        public void FailedCallToShoppingCartRepository_ShowsAlert()
        {
            var alertCalled = false;
            var shoppingCartRepository = new MockShoppingCartRepository();
            shoppingCartRepository.GetShoppingCartAsyncDelegate = () =>
                                                                      {
                                                                          throw new Exception();
                                                                      };
            var alertMessageService = new MockAlertMessageService();
            alertMessageService.ShowAsyncDelegate = (s, s1) =>
                                                        {
                                                            alertCalled = true;
                                                            Assert.AreEqual("ErrorServiceUnreachable", s1);
                                                            return Task.FromResult(string.Empty);
                                                        };
            var accountService = new MockAccountService();
            accountService.VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult((UserInfo)null);
            var target = new ShoppingCartTabUserControlViewModel(shoppingCartRepository, null, alertMessageService, new MockResourceLoader(), accountService);

            Assert.IsTrue(alertCalled);
        }
        public async Task Submit_WhenAnonymous_ShowsSignInControl()
        {
            bool showSignInCalled = false;
            var accountService = new MockAccountService()
                {
                    VerifySavedCredentialsAsyncDelegate = () => Task.FromResult<UserInfo>(null)
                };
            var signInUserControlViewModel = new MockSignInUserControlViewModel()
                                                 {
                                                     OpenDelegate = (a) => showSignInCalled = true
                                                 };
            var target = new CheckoutSummaryPageViewModel(new MockNavigationService(), null, null, null, null, null, accountService, null, null, signInUserControlViewModel);
            await target.SubmitCommand.Execute();

            Assert.IsTrue(showSignInCalled);
        }
コード例 #13
0
        public void ShoppingCartMerged_WhenAnonymousUserLogsIn()
        {
            bool mergeShoppingCartsCalled = false;
            bool alertMessageServiceCalled = false;
            var anonymousCartItems = new List<ShoppingCartItem>
                                         {
                                             new ShoppingCartItem
                                                 {Quantity = 1, Product = new Product {ProductNumber = "123"}}
                                         };
            var testUserCartItems = new List<ShoppingCartItem>
                                         {
                                             new ShoppingCartItem
                                                 {Quantity = 2, Product = new Product {ProductNumber = "123"}}
                                         };

            var shoppingCartService = new MockShoppingCartService()
                {
                    GetShoppingCartAsyncDelegate = s =>
                        {
                            switch (s)
                            {
                                case "AnonymousId": 
                                    return Task.FromResult(new ShoppingCart(anonymousCartItems));
                                default:
                                    return Task.FromResult(new ShoppingCart(testUserCartItems));
                            }
                        },
                    MergeShoppingCartsAsyncDelegate = (s, s1) =>
                        {
                            mergeShoppingCartsCalled = true;
                            Assert.AreEqual("AnonymousId", s);
                            Assert.AreEqual("TestUserName", s1);
                            return Task.FromResult(true);
                        }
                };
            var accountService = new MockAccountService();
            var shoppingCartUpdatedEvent = new MockShoppingCartUpdatedEvent
                {
                    PublishDelegate = () => { }
                };
            
            var eventAggregator = new MockEventAggregator()
                {
                    GetEventDelegate = (a) => shoppingCartUpdatedEvent
                };
            var sessionStateService = new MockSessionStateService();
            sessionStateService.SessionState[ShoppingCartRepository.ShoppingCartIdKey] = "AnonymousId";

            var target = new ShoppingCartRepository(shoppingCartService, accountService, eventAggregator, sessionStateService);
            accountService.RaiseUserChanged(new UserInfo { UserName = "******" }, null);

            Assert.IsTrue(mergeShoppingCartsCalled);
        }
コード例 #14
0
        public void CartUpdatedEventRaised_WhenUserChanged()
        {
            var shoppingCartUpdatedRaised = false;
            var accountService = new MockAccountService();
            var shoppingCartUpdatedEvent = new MockShoppingCartUpdatedEvent()
                {
                    PublishDelegate = () => shoppingCartUpdatedRaised = true
                };
            var eventAggregator = new MockEventAggregator()
                {
                    GetEventDelegate = (a) => shoppingCartUpdatedEvent
                };
            var shoppingCartService = new MockShoppingCartService()
                {
                    MergeShoppingCartsAsyncDelegate = (s, s1) => Task.FromResult(false)
                };

            var target = new ShoppingCartRepository(shoppingCartService, accountService, eventAggregator, new MockSessionStateService());
            accountService.RaiseUserChanged(new UserInfo { UserName = "******" }, null);

            Assert.IsTrue(shoppingCartUpdatedRaised);
        }
        public void ShoppingCartUpdated_WhenShoppingCartChanged()
        {
            var navigationService = new MockNavigationService();
            var accountService = new MockAccountService();
            var shoppingCartRepository = new MockShoppingCartRepository();
            shoppingCartRepository.GetShoppingCartAsyncDelegate = () =>
            {
                ShoppingCart shoppingCart = new ShoppingCart(new ObservableCollection<ShoppingCartItem>()) { Currency = "USD"};
                return Task.FromResult(shoppingCart);
            };
            bool signInUserControlOnNavigatedToCalled = false;
            var signInUserControlViewModel = new MockSignInUserControlViewModel()
            {
                OnNavigatedToDelegate = (a, b, c) => signInUserControlOnNavigatedToCalled = true
            };
            var eventAggregator = new MockEventAggregator();
            var shoppingCartUpdatedEvent = new ShoppingCartUpdatedEvent();
            eventAggregator.GetEventDelegate = type => shoppingCartUpdatedEvent;
            var target = new ShoppingCartPageViewModel(shoppingCartRepository, navigationService, accountService, signInUserControlViewModel, null, null, null, null, eventAggregator);
            target.OnNavigatedTo(new NavigatedToEventArgs { Parameter = null, NavigationMode = NavigationMode.New }, null);  

            Assert.AreEqual("$0.00", target.FullPrice);

            shoppingCartRepository.GetShoppingCartAsyncDelegate = () =>
            {
                var shoppingCartItems = new ObservableCollection<ShoppingCartItem>
                                            {
                                                new ShoppingCartItem() { Product = new Product { ListPrice = 100, ProductNumber = "p1", ImageUri = new Uri("http://image")}, Currency = "USD", Quantity = 2}, 
                                            };
                ShoppingCart shoppingCart = new ShoppingCart(new ObservableCollection<ShoppingCartItem>(shoppingCartItems)) { Currency = "USD" };
                return Task.FromResult(shoppingCart);
            };

            shoppingCartUpdatedEvent.Publish(null);

            Assert.IsTrue(signInUserControlOnNavigatedToCalled);
            Assert.AreEqual("$200.00", target.FullPrice);
        }
        public async Task Checkout_WhenAnonymous_ShowsSignInFlyout()
        {
            var modalCalled = false;
            var accountService = new MockAccountService
                {
                    VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult<UserInfo>(null)
                };
            var signInUserControlViewModel = new MockSignInUserControlViewModel
                {
                    OpenDelegate = (s) =>
                        {
                            modalCalled = true;
                            Assert.IsNotNull(s);
                        }
                };
            var checkoutDataRepository = new MockCheckoutDataRepository()
                {
                    GetDefaultShippingAddressAsyncDelegate = () => null,
                    GetDefaultBillingAddressAsyncDelegate =  () => null,
                    GetDefaultPaymentMethodAsyncDelegate = () => Task.FromResult<PaymentMethod>(null)
                };
            var eventAggregator = new MockEventAggregator
                {
                    GetEventDelegate = type => new MockShoppingCartUpdatedEvent()
                };
            var target = new ShoppingCartPageViewModel(null, new MockNavigationService(), accountService, signInUserControlViewModel, null, null, checkoutDataRepository, null, eventAggregator);

            await target.CheckoutCommand.Execute();

            Assert.IsTrue(modalCalled);
        }
        public async Task ExecuteGoNextCommand_DoNothing_IfViewModelsAreInvalid()
        {
            bool formProcessStarted = false;
            var accountService = new MockAccountService()
            {
                VerifyUserAuthenticationAsyncDelegate = () =>
                    {
                        // The process starts with a call to retrieve the logged user
                        formProcessStarted = true;
                        return Task.FromResult(new UserInfo());
                    }
            };
            var shippingAddressPageViewModel = new MockShippingAddressPageViewModel();
            var billingAddressPageViewModel = new MockBillingAddressPageViewModel();
            var paymentMethodPageViewModel = new MockPaymentMethodPageViewModel();
            var target = new CheckoutHubPageViewModel(new MockNavigationService(), accountService, null, null,
                                                       shippingAddressPageViewModel, billingAddressPageViewModel, paymentMethodPageViewModel, null, null);

            // ShippingAddress invalid only
            shippingAddressPageViewModel.ValidateFormDelegate = () => false;
            billingAddressPageViewModel.ValidateFormDelegate = () => true;
            paymentMethodPageViewModel.ValidateFormDelegate = () => true;
            await target.GoNextCommand.Execute();

            Assert.IsFalse(formProcessStarted);

            // BillingAddress invalid only
            shippingAddressPageViewModel.ValidateFormDelegate = () => true;
            billingAddressPageViewModel.ValidateFormDelegate = () => false;
            paymentMethodPageViewModel.ValidateFormDelegate = () => true;

            Assert.IsFalse(formProcessStarted);

            // PaymentMethod invalid only
            shippingAddressPageViewModel.ValidateFormDelegate = () => true;
            billingAddressPageViewModel.ValidateFormDelegate = () => true;
            paymentMethodPageViewModel.ValidateFormDelegate = () => false;

            Assert.IsFalse(formProcessStarted);
        }
        public async Task SettingUseShippingAddressToTrue_CopiesValuesFromShippingAddressToBilling()
        {
            var mockAddress = new Address()
                {
                    FirstName = "TestFirstName",
                    MiddleInitial = "TestMiddleInitial",
                    LastName = "TestLastName",
                    StreetAddress = "TestStreetAddress",
                    OptionalAddress = "TestOptionalAddress",
                    City = "TestCity",
                    State = "TestState",
                    ZipCode = "123456",
                    Phone = "123456"
                };
            var compareAddressesFunc = new Func<Address, Address, bool>((Address a1, Address a2) =>
                {
                    return a1.FirstName == a2.FirstName && a1.MiddleInitial == a2.MiddleInitial && a1.LastName == a2.LastName
                           && a1.StreetAddress == a2.StreetAddress && a1.OptionalAddress == a2.OptionalAddress && a1.City == a2.City
                           && a1.State == a2.State && a1.ZipCode == a2.ZipCode && a1.Phone == a2.Phone;
                });

            var shippingAddressPageViewModel = new MockShippingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = () => Task.Delay(0),
                    Address = mockAddress
                };
            var billingAddressPageViewModel = new MockBillingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true
                };
            billingAddressPageViewModel.ProcessFormAsyncDelegate = () =>
                {
                    // The Address have to be updated before the form is processed
                    Assert.IsTrue(compareAddressesFunc(shippingAddressPageViewModel.Address, billingAddressPageViewModel.Address));
                    return Task.Delay(0);
                };
            var paymentMethodPageViewModel = new MockPaymentMethodPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = async () => await Task.Delay(0),
                };
            var accountService = new MockAccountService()
                {
                    VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult(new UserInfo()),
                    SignedInUser = new UserInfo()
                };
            var orderRepository = new MockOrderRepository()
                {
                    CreateBasicOrderAsyncDelegate = (userId, shoppingCart, shippingAddress, billingAddress, paymentMethod) =>
                        {
                            // The Address information stored in the order must be the same
                            Assert.IsTrue(compareAddressesFunc(shippingAddress, billingAddress));
                            return Task.FromResult<Order>(new Order());
                        }
                };
            var shoppingCartRepository = new MockShoppingCartRepository()
                {
                    GetShoppingCartAsyncDelegate = () => Task.FromResult(new ShoppingCart(null))
                };
            var navigationService = new MockNavigationService()
                {
                    NavigateDelegate = (a, b) => true
                };

            var target = new CheckoutHubPageViewModel(navigationService, accountService, orderRepository, shoppingCartRepository,
                                            shippingAddressPageViewModel, billingAddressPageViewModel, paymentMethodPageViewModel, null, null);
            target.UseSameAddressAsShipping = true;

            await target.GoNextCommand.Execute();
        }
        public void ProcessFormAsync_WithServerValidationError_ShowsMessage()
        {
            var shippingAddressPageViewModel = new MockShippingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = () => Task.Delay(0),
                    Address = new Address()
                };
            var billingAddressPageViewModel = new MockBillingAddressPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = () => Task.Delay(0),
                    Address = new Address()
                };
            var paymentMethodPageViewModel = new MockPaymentMethodPageViewModel()
                {
                    ValidateFormDelegate = () => true,
                    ProcessFormAsyncDelegate = async () => await Task.Delay(0),
                    PaymentMethod = new PaymentMethod()
                };
            var accountService = new MockAccountService()
                {
                    VerifyUserAuthenticationAsyncDelegate = () => Task.FromResult(new UserInfo()),
                    SignedInUser = new UserInfo()
                };
            var shoppingCartRepository = new MockShoppingCartRepository()
                {
                    GetShoppingCartAsyncDelegate =
                        () => Task.FromResult(new ShoppingCart(null))
                };
            var orderRepository = new MockOrderRepository()
                {
                    CreateBasicOrderAsyncDelegate = (s, cart, arg3, arg4, arg5) =>
                         {
                             var result = new ModelValidationResult();
                             result.ModelState.Add("order.ShippingAddress.ZipCode", new List<string>{"Validation Message"});
                             throw new ModelValidationException(result);
                         }
                };
            var target = new CheckoutHubPageViewModel(new MockNavigationService(), accountService, orderRepository, shoppingCartRepository, shippingAddressPageViewModel,
                                                      billingAddressPageViewModel, paymentMethodPageViewModel, null, null);

            target.GoNextCommand.Execute();

            Assert.IsTrue(target.IsShippingAddressInvalid);
        }