public void SetCustomer_CustomerNullReference_ThrowsException() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new CustomerService(mockedRepository.Object); // act service.SetCustomer(null); }
public void SetCustomer_RequestNotExistingCustomer_SetsCustomerInRepository() { // arrange Mock<IRepository> mockedRepository = CreateMockedRepository(); var service = new CustomerService(mockedRepository.Object); const int customerId = 23; var customerInfo = new CustomerInfo { Id = customerId }; // act service.SetCustomer(customerInfo); // assert mockedRepository.Verify(p => p.SetCustomer(It.Is<Customer>(c => c.Id == customerId))); }