Exemplo n.º 1
0
        public void TestEndLoadAccounts()
        {
            //Given
            WCFAccountService accountService = _mocks.StrictMock <WCFAccountService>();
            IAsyncResult      result         = _mocks.Stub <IAsyncResult>();

            CustomerViewModel vm = new CustomerViewModel();

            vm.AccountService = accountService;

            //mock the collection returned by ThirdPartyService
            AccountDto account = new AccountDto {
                Balance = 100, BalanceDate = DateTime.Now, Id = 1, Title = "Account 1", Number = "123"
            };
            List <AccountDto> accounts = new List <AccountDto>();

            accounts.Add(account);

            Expect.Call(accountService.EndGetAccountsByCustomer(result)).Return(accounts);

            _mocks.ReplayAll();

            //When
            vm.EndLoadAccounts(result);

            Assert.IsFalse(vm.InProgress);
            Assert.Equals(vm.Accounts.Count, accounts.Count);
        }
Exemplo n.º 2
0
        public void TestLoadAccounts()
        {
            //Given
            CustomerViewModel vm             = new CustomerViewModel();
            WCFAccountService accountService = _mocks.StrictMock <WCFAccountService>();

            vm.AccountService = accountService;

            //create the individualcustomer
            CustomerDto customer = new CustomerDto()
            {
                Id = 1
            };

            vm.Customer = customer;

            //When
            vm.LoadAccounts();

            //Then
            Assert.IsTrue(vm.InProgress);
        }