public void UpdateCustomerIntegrationTest() { string returnMessage; TransactionalInformation transaction; CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService); DataGridPagingInformation paging = new DataGridPagingInformation(); paging.CurrentPageNumber = 1; paging.PageSize = 15; paging.SortExpression = "LastName"; paging.SortDirection = "ASC"; List <CustomerInquiry> customers = customerApplicationService.CustomerInquiry("", "", paging, out transaction); var customerInformation = (from c in customers select c).First(); Guid customerID = customerInformation.CustomerID; Customer customer = customerApplicationService.GetCustomerByCustomerID(customerID, out transaction); customerApplicationService.UpdateCustomer(customer, out transaction); returnMessage = Utilities.GetReturnMessage(transaction.ReturnMessage); Assert.AreEqual(true, transaction.ReturnStatus, returnMessage); }
public HttpResponseMessage CustomerInquiry(string FirstName, string LastName, int CurrentPageNumber, string SortExpression, string SortDirection, int PageSize) { TransactionalInformation transaction; if (FirstName == null) { FirstName = string.Empty; } if (LastName == null) { LastName = string.Empty; } if (SortDirection == null) { SortDirection = string.Empty; } if (SortExpression == null) { SortExpression = string.Empty; } CustomerInquiryViewModel customerInquiryViewModel = new CustomerInquiryViewModel(); DataGridPagingInformation paging = new DataGridPagingInformation(); paging.CurrentPageNumber = CurrentPageNumber; paging.PageSize = PageSize; paging.SortExpression = SortExpression; paging.SortDirection = SortDirection; if (paging.SortDirection == "") { paging.SortDirection = "ASC"; } if (paging.SortExpression == "") { paging.SortExpression = "LastName"; } CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService); List <CustomerInquiry> customers = customerApplicationService.CustomerInquiry(FirstName, LastName, paging, out transaction); customerInquiryViewModel.Customers = customers; customerInquiryViewModel.ReturnStatus = transaction.ReturnStatus; customerInquiryViewModel.ReturnMessage = transaction.ReturnMessage; customerInquiryViewModel.TotalPages = paging.TotalPages; customerInquiryViewModel.TotalRows = paging.TotalRows; customerInquiryViewModel.PageSize = paging.PageSize; if (transaction.ReturnStatus == true) { var response = Request.CreateResponse <CustomerInquiryViewModel>(HttpStatusCode.OK, customerInquiryViewModel); return(response); } var badResponse = Request.CreateResponse <CustomerInquiryViewModel>(HttpStatusCode.BadRequest, customerInquiryViewModel); return(badResponse); }
public void CustomerInquiryIntegrationTest() { TransactionalInformation transaction; CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService); DataGridPagingInformation paging = new DataGridPagingInformation(); paging.CurrentPageNumber = 1; paging.PageSize = 15; paging.SortExpression = "LastName"; paging.SortDirection = "ASC"; List <CustomerInquiry> customers = customerApplicationService.CustomerInquiry("", "", paging, out transaction); string returnMessage = Utilities.GetReturnMessage(transaction.ReturnMessage); Assert.AreEqual(15, customers.Count, returnMessage); }