using System; using Centron.BusinessLogic; using Centron.BusinessLogic.WebServices.Sales.Receipts; using Centron.Data.Entities.Administration.Logins; using CentronSoftware.Centron.WebServices.Entities.Sales.Receipts; namespace Centron.Tests.EndToEnd.Tests.ReceiptCartReleaseSystem; // This enum is used as a little helper for the test, to make it easier to call all these different actions public enum ReceiptCartAction { ReadyForCheck, CheckerApprove, CheckerDecline, ImproveCheckerDeclined, OrdererApprove, OrdererDecline, ImproveOrdererDeclined } public static class ReceiptCartActionExtensions { public static Func GetActualMethod(this ReceiptCartAction action, BLSession session) { return action switch { ReceiptCartAction.ReadyForCheck => Wrap(session.GetBL().ReadyCartForCheck), ReceiptCartAction.CheckerApprove => Wrap(session.GetBL().CheckerApproveCart), ReceiptCartAction.CheckerDecline => Wrap(session.GetBL().CheckerDeclineCart), ReceiptCartAction.ImproveCheckerDeclined => Wrap(session.GetBL().ImproveDeclinedByCheckerCart), ReceiptCartAction.OrdererApprove => session.GetBL().OrdererApproveCart, ReceiptCartAction.OrdererDecline => Wrap(session.GetBL().OrdererDeclineCart), ReceiptCartAction.ImproveOrdererDeclined => Wrap(session.GetBL().ImproveDeclinedByOrdererCart), _ => throw new ArgumentOutOfRangeException() }; Func Wrap(Action action) { return (cartI3D, currentUser) => { action(cartI3D, currentUser); return null; }; } } }