public async Task<ActionResult> Create(CustomerRequestModel customerRequestModel) { if (this.ModelState.IsValid) { CustomerRequest customerRequest = new CustomerRequest() { Name = customerRequestModel.Name, Email = customerRequestModel.Email, Locale = customerRequestModel.Locale }; await this._mollieClient.CreateCustomerAsync(customerRequest); return this.RedirectToAction("Index"); } return this.View(customerRequestModel); }
public void CanCreateNewCustomer() { // If: We create a customer request with only the required parameters CustomerRequest customerRequest = new CustomerRequest() { Email = "*****@*****.**", Name = "Smit", Locale = Locale.NL, Metadata = "{\"test\":\"test\"" }; // When: We send the customer request to Mollie CustomerResponse result = this._mollieClient.CreateCustomerAsync(customerRequest).Result; // then: Make sure the requested parameters match the response parameter values Assert.IsNotNull(result); Assert.AreEqual(customerRequest.Name, result.Name); Assert.AreEqual(customerRequest.Email, result.Email); Assert.AreEqual(customerRequest.Metadata, result.Metadata); }