Пример #1
0
        public static TicketPrintedAuditHistory BuildFor(SlotCabinetEventTicketPrinted ticket,
                                                         Action <TicketPrintedAuditHistory> customize = null)
        {
            var nextNumber = Utils.GetNextNaturalNumber();

            var ticketPrintedAuditHistory = new TicketPrintedAuditHistory
            {
                EventSequenceId = ticket.EventSequenceId,
                TicketStatusId  = TicketPrintedStatusEnum.Valid,
                AuditActionId   = TicketPrintedAuditActionEnum.None,
                UserId          = Guid.NewGuid().ToString(), //TODO: Get UnitTest UserId?
                Comment         = $"Comment{nextNumber}",
                AuditDateTime   = SliceFixture.GetSystemDateTime()
            };

            customize?.Invoke(ticketPrintedAuditHistory);
            ticket.TicketsPrintedAuditHistory.Add(ticketPrintedAuditHistory);

            return(ticketPrintedAuditHistory);
        }
Пример #2
0
        public ITicketPrintedAuditHistoryDataBuilder CreateValidTicket(int ticketCount = 1, Action <SlotCabinetEventTicketPrinted> customizeTicket = null)
        {
            //create a `TicketPrinted` Event and then create Ticket Printed

            foreach (var slotCabinetRegistration in SlotCabinetRegistrations)
            {
                for (int i = 0; i < ticketCount; i++)
                {
                    var slotCabinetEvent = SlotCabinetEventBuilderNew.BuildFor(slotCabinetRegistration, c =>
                    {
                        c.EventTypeId = (int)SlotEventType.TicketPrinted;
                    });
                    Tasks.Add(Task.Run(async() => { await SliceFixture.InsertAsync(slotCabinetEvent); }));
                    var slotCabinetEventTicketPrinted = SlotCabinetEventTicketPrintedBuilderNew.BuildFor(slotCabinetEvent, 1, customizeTicket);
                    SlotCabinetEventTicketsPrinted.Add(slotCabinetEventTicketPrinted);
                    Tasks.Add(Task.Run(async() => { await SliceFixture.InsertAsync(slotCabinetEventTicketPrinted); }));
                }
            }
            return(this);
        }
        public static SlotCabinetEventTicketPrinted BuildFor(SlotCabinetEvent slotCabinetEvent, int ticketNumber,
                                                             Action <SlotCabinetEventTicketPrinted> customizeTicket = null)
        {
            var slotCabinetEventTicketPrinted = new SlotCabinetEventTicketPrinted
            {
                Amount             = (uint)Utils.GetRandomTicketAmount(),
                SystemId           = (byte)ticketNumber,
                ValidationNumber   = "100",
                TicketNumber       = (ushort)ticketNumber,
                TicketType         = (byte)ticketNumber,
                PoolId             = (ushort)ticketNumber,
                PrintedDateTime    = SliceFixture.GetSystemDateTime(),
                ExpirationDateTime = SliceFixture.GetSystemDateTime().AddDays(2),
                EventSequenceId    = slotCabinetEvent.EventSequenceId,
            };

            customizeTicket?.Invoke(slotCabinetEventTicketPrinted);
            //update ticket hash
            slotCabinetEventTicketPrinted.TicketHash = null;//slotCabinetEventTicketPrinted.GenerateTicketHashCode(slotCabinetEvent.SlotCabinetRegistrationId);
            return(slotCabinetEventTicketPrinted);
        }