//[IgnoreProperty] public static string StatusDescription(DeliveryStatus status, string language) { switch (language) { case "NL": switch (status) { case DeliveryStatus.Backorder: return("Backorder"); case DeliveryStatus.Failed: return("Mislukt"); case DeliveryStatus.OfferedToDeliverer: return("Aangeboden aan uitleveraar"); case DeliveryStatus.SendFromDeliverer: return("Verzonden door uitleveraar"); case DeliveryStatus.ToDeliver: return("Uit te leveren"); case DeliveryStatus.Unavailable: return("Niet beschikbaar"); case DeliveryStatus.Cancelled: return("Geannuleerd"); } break; } return(status.ToString()); }
public async Task Update_ShouldSendEmaiToTheAnonymousUserWithTheCorrectContent() { mapper.Execute(); int testId = 1; DeliveryStatus status = DeliveryStatus.Done; string statusBG = EnglishBulgarianDictionary.Namings[status.ToString()]; var order = new Order() { Status = DeliveryStatus.Unpaid, Id = testId, UserЕmail = "testEmail" }; var ordersMock = new Mock <IOrdersService>(); ordersMock.Setup(v => v.GetById(testId)).Returns(order); var emailsMock = new Mock <IEmailsService>(); emailsMock.Setup(x => x.SendEmail( order.UserЕmail, string.Format(GlobalConstants.OrderUpdated, order.Id), It.Is <string>(y => y.Contains("Нов статус на поръчка") && y.Contains(testId.ToString()) && y.Contains(statusBG)), GlobalConstants.SMTPServer, GlobalConstants.EmailPrimary, GlobalConstants.EmailPrimaryPassword)); OrderRequestUpdateStatusModel request = new OrderRequestUpdateStatusModel() { Id = testId, Status = status }; var controller = new ManageOrdersController(ordersMock.Object, emailsMock.Object, null); var result = await controller.Update(request); Assert.IsInstanceOfType(result, typeof(OkNegotiatedContentResult <OrderResponseModelWIthUserInfo>)); var responseContent = ((OkNegotiatedContentResult <OrderResponseModelWIthUserInfo>)result).Content; Assert.AreEqual(responseContent.Id, testId); emailsMock.VerifyAll(); }
public Delivery(Guid?delivererId, string customerPhoneNumber, DateTime dueDate, Vehicles vehicle, Guid?startedAtId, double?warehouseDistanceInKilometers, DateTime?warehouseETA, Guid warehouseId, DateTime?warehousePickUpAt, double?customerDistanceInKilometers, DateTime?customerETA, Guid customerId, Guid?currentId, DateTime?deliveredAt, double price, double?tip, PaymentMethods paymentMethod, DeliveryStatus status) { this.DelivererId = delivererId; this.CustomerPhoneNumber = customerPhoneNumber; this.DueDate = dueDate; this.Vehicle = vehicle; this.VehicleDisplayName = Instance().GetDisplayName(vehicle.GetType(), vehicle.ToString()); this.StartedAtId = startedAtId; this.WarehouseDistanceInKilometers = warehouseDistanceInKilometers; this.WarehouseETA = warehouseETA; this.WarehouseId = warehouseId; this.WarehousePickUpAt = warehousePickUpAt; this.CustomerDistanceInKilometers = customerDistanceInKilometers; this.CustomerETA = customerETA; this.CustomerId = customerId; this.CurrentId = currentId; this.DeliveredAt = deliveredAt; this.Price = price; this.Tip = tip; this.PaymentMethod = paymentMethod; this.PaymentMethodDisplayName = Instance().GetDisplayName(paymentMethod.GetType(), paymentMethod.ToString()); this.Status = status; this.StatusDisplayName = Instance().GetDisplayName(status.GetType(), status.ToString()); }
/// <summary> /// Public constructor without navigational properties and Id /// </summary> /// <param name="delivererId"></param> /// <param name="customerPhoneNumber"></param> /// <param name="dueDate"></param> /// <param name="vehicle"></param> /// <param name="startedAtId"></param> /// <param name="warehouseDistanceInKilometers"></param> /// <param name="warehouseETA"></param> /// <param name="warehouseId"></param> /// <param name="warehousePickUpAt"></param> /// <param name="customerDistanceInKilometers"></param> /// <param name="customerETA"></param> /// <param name="customerId"></param> /// <param name="currentId"></param> /// <param name="deliveredAt"></param> /// <param name="price"></param> /// <param name="tip"></param> /// <param name="paymentMethod"></param> /// <param name="status"></param> public Delivery(Guid id, string customerPhoneNumber, DateTime dueDate, Vehicles vehicle, string vehicleDisplayName, double price, PaymentMethods paymentMethod, DeliveryStatus status) { this.CustomerPhoneNumber = customerPhoneNumber; this.DueDate = dueDate; this.Vehicle = vehicle; this.VehicleDisplayName = vehicleDisplayName; this.VehicleDisplayName = Instance().GetDisplayName(vehicle.GetType(), vehicle.ToString()); this.Price = price; this.PaymentMethod = paymentMethod; this.PaymentMethodDisplayName = Instance().GetDisplayName(paymentMethod.GetType(), paymentMethod.ToString()); this.Status = status; this.StatusDisplayName = Instance().GetDisplayName(status.GetType(), status.ToString()); }
private MessageStatus ConvertDeliveryResultToMessageResult(DeliveryStatus deliveryStatus, string distributionId) { MessageStatus status; switch (deliveryStatus) { case DeliveryStatus.Delivered: status = MessageStatus.Delivered; break; case DeliveryStatus.DeliveryFailed: status = MessageStatus.Failed; break; case DeliveryStatus.Pending: status = MessageStatus.Pending; break; default: throw new ArgumentException(string.Format("Cant map DeliveryStatus from MessageService DeliveryStatus: {0}, distributionId: {1}.", deliveryStatus.ToString(), distributionId)); } return(status); }