public void AddService(DtoCustomerService customerService) { var customer = _customerRepository.GetCustomer(customerService.CustomerId); var service = CreateServiceByServiceId(customerService.ServiceId); customer.Services.Add(service); }
public void AddService_should_call_CustomerRepository_GetCustomer_once() { var c = new DtoCustomerService() { CustomerId = _customerId, ServiceId = "A" }; _sut.AddService(c); Mock.Get(_customerRepository).Verify(x => x.GetCustomer(c.CustomerId), Times.Once); }
public void AddService_should_add_new_service_to_customer() { var c = new DtoCustomerService() { CustomerId = _customerId, ServiceId = "C" }; _sut.AddService(c); Assert.That(_customer.Services.First(x => x.StartDate.Date == DateTime.Today).ServiceId, Is.EqualTo(c.ServiceId)); }
public ActionResult Post(DtoCustomerService customerService) { _customerService.AddService(customerService); return(Ok()); }