예제 #1
0
파일: Tests.cs 프로젝트: x8mhz/winforms-mvp
        public void Presenter_SaveCustomer_ShouldSaveSelectedCustomerToRepository()
        {
            var mockView = Mock.Get(mockCustomerView);

            mockView.Setup(view => view.SelectedCustomer).Returns(2);
            mockView.Setup(view => view.CustomerName).Returns(stubCustomerList[2].Name);
            mockView.Setup(view => view.Address).Returns(stubCustomerList[2].Address);
            mockView.Setup(view => view.Phone).Returns(stubCustomerList[2].Phone);

            presenter.SaveCustomer();

            var mockRepo = Mock.Get(mockCustomerRepository);

            mockRepo.Verify(repository => repository.SaveCustomer(2, stubCustomerList[2]));
        }