public void Create_SetsWorkTypeFromConsumerClassificationType() { var customerRequest = new CustomerRequestVO { ConsumerClassificationType = ConsumerClassificationTypes.Residential }; var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsWorkType(customerRequest, actual); Assert.AreEqual(WorkType.Home, actual.WorkType); }
public void Create_SetsOrderNumberFromBillOfLading() { var customerRequest = new CustomerRequestVO(); customerRequest.ReferenceNumbers.Add(new ReferenceNumberVO { ReferenceNumber = "1", ReferenceNumberType = ReferenceNumberTypes.PurchaseOrderNumber }); customerRequest.ReferenceNumbers.Add(new ReferenceNumberVO { ReferenceNumber = "2", ReferenceNumberType = ReferenceNumberTypes.BillOfLading }); var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsOrderNumber(customerRequest, actual); Assert.AreEqual("2", actual.OrderNumber.ToString()); }
public void Create_SetsLegTypeToDeliveryWhenLastStopIsShipTo() { var customerRequest = new CustomerRequestVO(); customerRequest.Stops.Add(new StopVO { StopNumber = 1 }); customerRequest.Stops.Add(new StopVO { StopNumber = 2, RoleType = StopRoleTypes.ShipTo }); var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsLegType(customerRequest, actual); Assert.AreEqual(LegType.Delivery, actual.LegType); }
public void Create_SetsDestinationFromLastStop() { var customerRequest = new CustomerRequestVO(); customerRequest.Stops.Add(new StopVO { StopNumber = 1, OrganizationName = "Southeastern", AddressLine1 = "1205 N Oak Street", AddressCityName = "Hammond", AddressStateCode = "LA", AddressPostalCode = "70402" }); customerRequest.Stops.Add(new StopVO { StopNumber = 2, OrganizationName = "Bob Smith", AddressLine1 = "555 Somewhere Ave", AddressCityName = "Nowhere", AddressStateCode = "LA", AddressPostalCode = "76543" }); var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsOrigin(customerRequest, actual); Assert.IsInstanceOfType(actual.Destination, typeof(Customer)); Assert.AreEqual("Bob Smith", actual.Destination.Name); Assert.AreEqual("555 Somewhere Ave", actual.Destination.Address.AddressLines[0]); Assert.AreEqual(String.Empty, actual.Destination.Address.AddressLines[1]); Assert.AreEqual("Nowhere", actual.Destination.Address.City); Assert.AreEqual("LA", actual.Destination.Address.StateCode); Assert.AreEqual("76543", actual.Destination.Address.PostalCode); }
public void Create_SetsScheduledFromFinalAppointmentWhenExists() { var customerRequest = new CustomerRequestVO(); customerRequest.Appointments.Add(new AppointmentVO { FunctionType = AppointmentFunctionTypes.Target, AppointmentBegin = DateTime.Today, AppointmentEnd = DateTime.Today.AddDays(1) }); customerRequest.Appointments.Add(new AppointmentVO { FunctionType = AppointmentFunctionTypes.Final, AppointmentBegin = DateTime.Today.AddDays(2), AppointmentEnd = DateTime.Today.AddDays(3) }); var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsScheduled(customerRequest, actual); Assert.AreEqual(DateTime.Today.AddDays(2), actual.Scheduled.Start); Assert.AreEqual(DateTime.Today.AddDays(3), actual.Scheduled.End); }
public IEnumerable<CustomerRequestVO> GetCustomerRequestsByReferenceNumberAndBusinessName(CustomerRequestVO customerRequest) { throw new NotImplementedException(); }
public void Create_SetsProjectFromBusinessEntityKey() { var customerRequest = new CustomerRequestVO { BusinessEntityKey = ProjectCodes.Southeastern }; var actual = OrderFactory.GetInstance().Create(customerRequest); actual = OrderFactory.SetsProject(customerRequest, actual); Assert.AreEqual(ProjectCodes.Southeastern, actual.Project); }
public static Order SetsOrderNumber(CustomerRequestVO customerRequest, Order order) { // test 2/9, Create_SetsOrderNumberFromBillOfLading var orderNum = (from refNum in customerRequest.ReferenceNumbers where (refNum.ReferenceNumberType == ReferenceNumberTypes.BillOfLading) select refNum.ReferenceNumber).First(); order.OrderNumber = new OrderNumber(orderNum); return order; }
public CustomerRequestVO GetCustomerRequestByIdentity(CustomerRequestVO customerRequest) { throw new NotImplementedException(); }
public static Order SetsProject(CustomerRequestVO customerRequest, Order order) { // test 9/9, Create_SetsProjectFromBusinessEntityKey order.Project = customerRequest.BusinessEntityKey; return order; }
public Order Create(CustomerRequestVO customerRequest) { var order = new Order(); //// test 2/9, Create_SetsOrderNumberFromBillOfLading //var orderNum = (from refNum // in customerRequest.ReferenceNumbers // where (refNum.ReferenceNumberType == ReferenceNumberTypes.BillOfLading) // select refNum.ReferenceNumber).First(); //order.OrderNumber = new OrderNumber(orderNum); //// test 3/9 Create_SetsOriginFromFirstStop //var origin = (from stop // in customerRequest.Stops // select stop).OrderByDescending(x => x.StopNumber).First(); //var address = new Address(origin.AddressLine1, origin.AddressLine2, origin.AddressCityName,origin.AddressStateCode, origin.AddressPostalCode); //order.Origin = new Facility(origin.OrganizationName, address); //// test 4/9, Create_SetsDestinationFromLastStop //var destination = (from stop // in customerRequest.Stops // select stop).OrderByDescending(x => x.StopNumber).Last(); //var address1 = new Address(destination.AddressLine1, destination.AddressLine2, destination.AddressCityName,destination.AddressStateCode, destination.AddressPostalCode); //order.Origin = new Facility(destination.OrganizationName, address1); //// test 5/9, Create_SetsWorkTypeFromConsumerClassificationType //var consumer = customerRequest.ConsumerClassificationType; //if (consumer == "HOMEDELVR") //{ // order.WorkType = WorkType.Home; //}else if (consumer == "BLDRDIRECT" || consumer == "BLDRINDRCT") //{ // order.WorkType = WorkType.Builder; //}else //{ // order.WorkType = WorkType.Retail; //} //// test 6/9, Create_SetsLegTypeToDeliveryWhenLastStopIsShipTo //var status = (from stop // in customerRequest.Stops // select stop).OrderByDescending(x => x.StopNumber).Last(); //if (status.RoleType == StopRoleTypes.ShipTo) //{ // order.LegType = LegType.Delivery; //} //// test 7/9, Create_SetsScheduledFromFinalAppointmentWhenExists //var final = (from appt // in customerRequest.Appointments // select appt).OrderByDescending(x => x.FunctionType).First(); //if (final.FunctionType != null) //{ // order.Scheduled = new Appointment(final.AppointmentBegin.Value, final.AppointmentEnd.Value); //} //else //{ // // test 8/9, Create_SetsScheduledEmptyWhenFinalAppointmentNotExists // order.Scheduled.IsEmpty(); //} //// test 9/9, Create_SetsProjectFromBusinessEntityKey //order.Project = customerRequest.BusinessEntityKey; return order; }
public static Order SetsScheduled(CustomerRequestVO customerRequest, Order order) { // test 7/9, Create_SetsScheduledFromFinalAppointmentWhenExists var final = (from appt in customerRequest.Appointments select appt).OrderByDescending(x => x.FunctionType).First(); if (final.FunctionType != null) { order.Scheduled = new Appointment(final.AppointmentBegin.Value, final.AppointmentEnd.Value); } else { // test 8/9, Create_SetsScheduledEmptyWhenFinalAppointmentNotExists order.Scheduled.IsEmpty(); } return order; }
public static Order SetsLegType(CustomerRequestVO customerRequest, Order order) { // test 6/9, Create_SetsLegTypeToDeliveryWhenLastStopIsShipTo var status = (from stop in customerRequest.Stops select stop).OrderByDescending(x => x.StopNumber).Last(); if (status.RoleType == StopRoleTypes.ShipTo) { order.LegType = LegType.Delivery; } return order; }
public static Order SetsWorkType(CustomerRequestVO customerRequest, Order order) { // test 5/9, Create_SetsWorkTypeFromConsumerClassificationType var consumer = customerRequest.ConsumerClassificationType; if (consumer == "HOMEDELVR") { order.WorkType = WorkType.Home; } else if (consumer == "BLDRDIRECT" || consumer == "BLDRINDRCT") { order.WorkType = WorkType.Builder; } else { order.WorkType = WorkType.Retail; } return order; }
public static Order SetsDestinationFromLastStop(CustomerRequestVO customerRequest, Order order) { // test 4/9, Create_SetsDestinationFromLastStop var destination = (from stop in customerRequest.Stops select stop).OrderByDescending(x => x.StopNumber).Last(); var address1 = new Address(destination.AddressLine1, destination.AddressLine2, destination.AddressCityName, destination.AddressStateCode, destination.AddressPostalCode); order.Origin = new Facility(destination.OrganizationName, address1); return order; }
public static Order SetsOrigin(CustomerRequestVO customerRequest, Order order) { // test 3/9 Create_SetsOriginFromFirstStop var origin = (from stop in customerRequest.Stops select stop).OrderByDescending(x => x.StopNumber).First(); var address = new Address(origin.AddressLine1, origin.AddressLine2, origin.AddressCityName, origin.AddressStateCode, origin.AddressPostalCode); order.Origin = new Facility(origin.OrganizationName, address); return order; }