public void CustomerCreated() { CustomerInformation customerInfo = new CustomerInformation(); customerInfo.Customer = customer; TestCrmService service = new TestCrmService(context); service.Switch = DataSwitch.Created; parameterService = new PatchParameterService(); controller = new CustomerController(customerService, service, parameterService); controller.Request = new System.Net.Http.HttpRequestMessage(); controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var response = controller.Create(customerInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); }
public void CustomerUpdated() { JsonPatchDocument <CustomerInformation> customerInfo = new JsonPatchDocument <CustomerInformation>(); customerInfo.Add("Customer/CustomerIdentity/FirstName", "John"); customerInfo.Add("Customer/CustomerGeneral/CustomerType", "Person"); TestCrmService service = new TestCrmService(context); service.Switch = DataSwitch.Updated; parameterService = new PatchParameterService(); controller = new CustomerController(customerService, service, parameterService); controller.Request = new System.Net.Http.HttpRequestMessage(); controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); var response = controller.Update("123", customerInfo); Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent); }
public void TestSetup() { context = new XrmFakedContext(); crmService = new TestCrmService(context); parameterService = new PatchParameterService(); customerService = new CustomerService(new CountryBucket(crmService), new SourceMarketBucket(crmService)); controller = new CustomerController(customerService, crmService, parameterService); controller.Request = new System.Net.Http.HttpRequestMessage(); controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); customer = new Customer(); customer.CustomerGeneral = new CustomerGeneral(); customer.CustomerGeneral.CustomerType = CustomerType.Person; customer.CustomerIdentifier = new CustomerIdentifier(); customer.CustomerIdentifier.CustomerId = "123"; customer.CustomerIdentity = new CustomerIdentity(); customer.CustomerIdentity.FirstName = "Mock"; customer.CustomerIdentity.LastName = "Test"; customer.CustomerIdentity.Salutation = "Mr"; customer.CustomerIdentity.Language = "EN"; customer.CustomerIdentity.Birthdate = "01-01-1990"; }
public CustomerController(ICustomerService customerService, ICrmService crmService, IPatchParameterService parameterService) { this.customerService = customerService; this.crmService = crmService; this.parameterService = parameterService; }