private void OnResetDBPleaseWait()
        {
            ThreadHelper.StopAll();
            var serviceRuntimeUserCertificateStore = new X509Store(StoreName.My);

            serviceRuntimeUserCertificateStore.Open(OpenFlags.ReadWrite);
            for (int i = 0; i < serviceRuntimeUserCertificateStore.Certificates.Count;)
            {
                var certificate = serviceRuntimeUserCertificateStore.Certificates[i];
                if (certificate.Subject.Contains("Sportradar AG"))
                {
                    serviceRuntimeUserCertificateStore.Remove(certificate);
                    continue;
                }
                i++;
            }
            PrinterHandler.DeleteAllPrinterObjects();
            ConnectionManager.CloseAll();
            DatabaseManager.DropDatabase(false);
            System.Diagnostics.Process.Start("shutdown.exe", "-s -t 0");
        }
        public void PrintdublicateTest()
        {
            IoCContainer.Kernel.Rebind <IStationRepository>().To <StationRepository>().InSingletonScope();

            var rep = IoCContainer.Kernel.Get <IStationRepository>();

            //rep.Init();
            rep.UsePrinter = true;

            IoCContainer.Kernel.Unbind <IConfidenceFactor>();
            IoCContainer.Kernel.Bind <IConfidenceFactor>().ToConstant <IConfidenceFactor>(ConfidenceFactor.Object).InSingletonScope();
            ConfidenceFactor.Setup(x => x.CalculateFactor(It.IsAny <Ticket>())).Returns(1000000);

            IoCContainer.Kernel.Unbind <IStationRepository>();
            IoCContainer.Kernel.Unbind <IChangeTracker>();
            var ChangeTracker = new ChangeTracker();

            IoCContainer.Kernel.Bind <IChangeTracker>().ToConstant <IChangeTracker>(ChangeTracker).InSingletonScope();

            IoCContainer.Kernel.Unbind <IDataBinding>();
            var DataBinding = new DataBinding();

            IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope();

            IoCContainer.Kernel.Unbind <ITicketHandler>();
            var TicketHandler = new TicketHandler();

            IoCContainer.Kernel.Bind <ITicketHandler>().ToConstant <ITicketHandler>(TicketHandler).InSingletonScope();

            BusinessPropsHelper.Setup(x => x.GetNextTransactionId()).Returns("123");

            var stationRepository = new StationRepository();

            IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(stationRepository).InSingletonScope();
            stationRepository.MaxOdd            = 1000;
            stationRepository.MaxCombination    = 1000;
            stationRepository.MaxStakeSystemBet = 1000;
            stationRepository.MaxStakeCombi     = 1000;
            stationRepository.MaxSystemBet      = 1000;
            stationRepository.MaxWinSystemBet   = 10000;
            stationRepository.MaxWinSingleBet   = 10000;
            stationRepository.IsReady           = true;
            stationRepository.BonusFromOdd      = 1.30m;
            stationRepository.UsePrinter        = true;
            StationSettings.Setup(x => x.UsePrinter).Returns(true);
            long[] tipLock;
            long[] tournamentlock;
            TicketHandler.TicketsInBasket.Add(new Ticket());
            WsdlRepository.Setup(x => x.SaveTicket(It.IsAny <string>(), It.IsAny <uid>(), It.IsAny <TicketWS>(), It.IsAny <bool>(), It.IsAny <string>(), out tipLock, out tournamentlock)).Returns("1");
            TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd {
                OutcomeId = 1, OddId = { Value = 1 }, OddView = new TestOddVw()
                {
                    Value = 1
                }, BetDomain = new TestBetDomain {
                    BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 1, Match = new TestMatchLn {
                        MatchId = 1, Code = { Value = 1 }, MatchView = new TestMatchVw {
                            LineObject = new MatchLn()
                        }
                    }
                }, Value = { Value = 1.14M }
            })
            {
                IsBank = true
            });
            TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd {
                OutcomeId = 2, OddId = { Value = 2 }, OddView = new TestOddVw()
                {
                    Value = 2
                }, BetDomain = new TestBetDomain {
                    BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 2, Match = new TestMatchLn {
                        MatchId = 2, Code = { Value = 2 }, MatchView = new TestMatchVw {
                            LineObject = new MatchLn()
                        }
                    }
                }, Value = { Value = 1.40M }
            }));
            TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd {
                OutcomeId = 3, OddId = { Value = 3 }, OddView = new TestOddVw()
                {
                    Value = 3
                }, BetDomain = new TestBetDomain {
                    BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 3, Match = new TestMatchLn {
                        MatchId = 3, Code = { Value = 3 }, MatchView = new TestMatchVw {
                            LineObject = new MatchLn()
                        }
                    }
                }, Value = { Value = 1.50M }
            }));
            TicketHandler.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd {
                OutcomeId = 4, OddId = { Value = 4 }, OddView = new TestOddVw()
                {
                    Value = 4
                }, BetDomain = new TestBetDomain {
                    BetDomainNumber = new ObservableProperty <int>(new BetDomainLn(), new ObservablePropertyList(), "test"), BetDomainId = 4, Match = new TestMatchLn {
                        MatchId = 4, Code = { Value = 4 }, MatchView = new TestMatchVw {
                            LineObject = new MatchLn()
                        }
                    }
                }, Value = { Value = 1.25M }
            }));


            stationRepository.BonusRangeList.Add(new BonusRangeWS {
                tipSize = 1, bonus = 3
            });


            TicketHandler.TicketsInBasket[0].Stake = 10;

            ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10);

            TicketHandler.TicketState = TicketStates.System;
            TicketHandler.TicketsInBasket[0].SystemX = 2;

            TicketHandler.TicketsInBasket[0].Stake = 5;


            TicketHandler.UpdateTicket();


            var      ticketActions = new TicketActions();
            TicketWS ticket        = ticketActions.CreateNewTicketWS(TicketHandler.TicketsInBasket[0]);

            ticketActions.SaveTicket(ref ticket, ChangeTracker.CurrentUser);

            var PrinterHandler = new PrinterHandler();

            stationRepository.UsePrinter = true;
            PrinterHandler.PrintTicket(ticket, false);

            Assert.AreEqual(PrinterHandler.NotPrintedItemsCount, 1);
            PrinterHandler.PrintTicket(ticket, false);
            Assert.AreEqual(PrinterHandler.NotPrintedItemsCount, 2);

            PrinterHandler.DeleteAllPrinterObjects();
            Assert.AreEqual(0, PrinterHandler.NotPrintedItemsCount);
        }