public void Ctor_Always_CallsGetCustomer() { // Arrange IUiDataProvider uiDataProviderMock = MockRepository.GenerateMock <IUiDataProvider>(); const string expectedId = "EXPECTEDID"; uiDataProviderMock.Expect(c => c.GetCustomer(expectedId)).Return(new Customer()); // Act CustomerDetailsViewModel target = new CustomerDetailsViewModel(uiDataProviderMock, expectedId); // Assert uiDataProviderMock.VerifyAllExpectations(); }
public void Customers_Always_CallsGetCustomers() { // Create Stub IUiDataProvider uiDataProviderMock = MockRepository.GenerateMock <IUiDataProvider>(); uiDataProviderMock.Expect(c => c.GetCustomers()); IToolManager toolManager = MockRepository.GenerateMock <IToolManager>(); // Inject Stub MainWindowViewModel target = new MainWindowViewModel(uiDataProviderMock, toolManager); // call the method - Although it doesn't do anything with the list, if this is not called an exception would be called. IList <Customer> customers = target.Customers; uiDataProviderMock.VerifyAllExpectations(); }