コード例 #1
0
        public HttpResponseMessage Transactions(int customerId = 0, string email = "")
        {
            if (customerId != 0 || !string.IsNullOrEmpty(email))
            {
                var customer = CustomerUtilities.GetCustomerByIdOrEmail(customerId, email);
                if (customer != null)
                {
                    var model = CustomerUtilities.Model(customer);
                    return(Request.CreateResponse(HttpStatusCode.OK, model));
                }

                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
コード例 #2
0
        private void TestCustomerTransactions_ShouldReturnCustomer()
        {
            var customer = CustomerUtilities.GetCustomerByIdOrEmail(email: "*****@*****.**");

            Assert.AreEqual(true, customer.Transactions.Count() > 0);
        }
コード例 #3
0
        private void TestCustomerEmail_ShouldReturnCustomer()
        {
            var customer = CustomerUtilities.GetCustomerByIdOrEmail(email: "*****@*****.**");

            Assert.AreEqual(true, customer != null);
        }
コード例 #4
0
        private void TestCustomerId_ShouldReturnCustomer()
        {
            var customer = CustomerUtilities.GetCustomerByIdOrEmail(435622);

            Assert.AreEqual(true, customer != null);
        }