public object Any(StoreCustomers request)
 {
     db.CreateTableIfNotExists <Customer>();
     foreach (var customer in request.Customers)
     {
         db.Insert(customer);
     }
     return(request.Customers.Count);
 }
        /// <summary>Anies the given request.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>An object.</returns>
        public object Any(StoreCustomers request)
        {
            db.CreateTable <Customer>(false);
            foreach (var customer in request.Customers)
            {
                db.Insert(customer);
            }

            return(null);
        }
Пример #3
0
        private static void StoreAndGetCustomers(ServiceController serviceController)
        {
            var storeCustomers = new StoreCustomers
            {
                Customers =
                {
                    new Customer {
                        Id = 1, FirstName = "First", LastName = "Customer"
                    },
                    new Customer {
                        Id = 2, FirstName = "Second", LastName = "Customer"
                    },
                }
            };

            serviceController.Execute(storeCustomers);

            storeCustomers = new StoreCustomers
            {
                Customers =
                {
                    new Customer {
                        Id = 3, FirstName = "Third", LastName = "Customer"
                    },
                }
            };
            serviceController.Execute(storeCustomers);

            var response = serviceController.Execute(new GetCustomer {
                CustomerId = 2
            });

            Assert.That(response as GetCustomerResponse, Is.Not.Null);

            var customer = ((GetCustomerResponse)response).Customer;

            Assert.That(customer.FirstName, Is.EqualTo("Second"));
        }
Пример #4
0
 // This method add to the _storeCustomers dictionary the Customer's CustRefNo property as a key and a Customer object as a value.
 public void addCustomer(Customer dictCustomer)
 {
     StoreCustomers.Add(dictCustomer.CustRefNo, dictCustomer);
 }