public static SlotCabinetRegistration BuildFor(SlotCabinet slotCabinet, bool addRegisterEvent = true, Action <SlotCabinetRegistration> customize = null)
        {
            var slotCabinetRegistration = new SlotCabinetRegistration
            {
                MacAddress           = Utils.SampleMacAddress(),
                SasVersion           = "SasVersion",
                SlotCabinetId        = slotCabinet.SlotCabinetId,
                RegistrationDateTime = SliceFixture.GetSystemDateTime(),
            };

            customize?.Invoke(slotCabinetRegistration);

            slotCabinet.SlotCabinetRegistrations.Add(slotCabinetRegistration);

            if (addRegisterEvent)
            {
                //auto add a register cabinet event on new cabinet registration addition
                var slotCabinetEvent = SlotCabinetEventBuilderNew.BuildFor(slotCabinetRegistration, sce =>
                {
                    sce.EventTypeId = (int)SlotEventType.RegisterCabinet;
                });
                slotCabinetRegistration.SlotCabinetEvents.Add(slotCabinetEvent);
            }

            return(slotCabinetRegistration);
        }
Ejemplo n.º 2
0
 public ISlotCabinetEventDataBuilder AddCustomSlotCabinetEvent(Action <SlotCabinetEvent> customize = null)
 {
     foreach (var slotCabinetRegistration in SlotCabinetRegistrations)
     {
         var slotCabinetEvent = SlotCabinetEventBuilderNew.BuildFor(slotCabinetRegistration, customize);
         Tasks.Add(Task.Run(async() =>
         {
             await SliceFixture.InsertAsync(slotCabinetEvent);
         }));
     }
     return(this);
 }
Ejemplo n.º 3
0
        public ISlotCabinetEventDataBuilder RegisterCabinet(Action <SlotCabinetRegistration> customize = null)
        {
            foreach (var slotCabinet in SlotCabinets)
            {
                var slotCabinetRegistration = SlotCabinetRegistrationBuilderNew.BuildFor(slotCabinet, false, customize);
                SlotCabinetRegistrations.Add(slotCabinetRegistration);
                Tasks.Add(Task.Run(async() => { await SliceFixture.InsertAsync(slotCabinetRegistration); }));

                var slotCabinetEvent = SlotCabinetEventBuilderNew.BuildFor(slotCabinetRegistration, c =>
                {
                    c.EventTypeId = (int)SlotEventType.RegisterCabinet;
                });
                Tasks.Add(Task.Run(async() => { await SliceFixture.InsertAsync(slotCabinetEvent); }));
            }
            return(this);
        }
Ejemplo n.º 4
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);
        }