コード例 #1
0
 public when_bind_account_details()
 {
     _view = new Mock<IAddEditAccountView>();
     _view.SetupAllProperties();
     var accountService = new Mock<IAccountService>();
     var accountId = Guid.NewGuid();
     accountService.Setup(a => a.GetAccount(accountId)).Returns(new Service.Edmx.Account
                                                                                                                                  {
                                                                                                                                      ID = accountId,
                                                                                                                                      Name = _accountName
                                                                                                                                  });
     _presenter = new AddEditAccountPresenter(_view.Object, accountService.Object);
     _presenter.BindAccountDetails(accountId);
 }
コード例 #2
0
            public when_saving()
            {
                _view = new Mock<IAddEditAccountView>();
                _view.SetupAllProperties();
                var accountService = new Mock<IAccountService>();
                SetANewAccount();
                SetAnExistingAccount();
                accountService.Setup(a => a.Insert(_newAccount)).Returns(new Service.Edmx.Account
                                                                                                                                                    {
                                                                                                                                                        ID = Guid.NewGuid()
                                                                                                                                                    });
                accountService.Setup(a => a.Update(_anExistingAccount)).Returns(new Service.Edmx.Account
                                                                                                                                                        {
                                                                                                                                                            ID = _anExistingAccount.ID,
                                                                                                                                                            Name = "updated"
                                                                                                                                                        });

                _presenter = new AddEditAccountPresenter(_view.Object, accountService.Object);
            }