public void Customers_Get_All() { // Set test Get method w/o parameters request.Setup(m => m.Get <Response <IEnumerable <Customer> > >("customers", null)).Returns(new Response <IEnumerable <Customer> > { Data = new List <Customer> { new Customer { Id = 666 } } }); // Test Get method var result = customersProxy.Get(); // Verify test Assert.IsNotNull(result); Assert.IsTrue(result.IsSuccessful); Assert.AreEqual(1, result.Data.Count()); Assert.AreEqual(666, result.Data.ElementAt(0).Id); }
public void Process(OrderForm orderForm) { OrderValidator.Validate(orderForm); var customer = _customers.Get(orderForm.CustomerDetails.Email); var orderLines = orderForm .OrderLines .Select(orderLine => _orderLineFactory.Validate(orderLine)).ToArray(); if (orderLines.Any(x => x == null)) { throw new Exception("Something went wrong"); } var order = new Order { Customer = customer, OrderLines = orderLines }; _fulfilment.Process(order); }
public Customer Get(int id) { return(_customer.Get(id)); }