public void AnonynousCashpoolNoBets()
        {
            var     stationRepository = new StationRepository();
            decimal reserved;
            decimal factor;

            WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out reserved, out factor)).Returns(10m);
            StationSettings StationSettings = new StationSettings();

            IoCContainer.Kernel.Rebind <IStationSettings>().ToConstant(StationSettings).InSingletonScope();

            TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>());
            TicketHandler.Object.TicketsInBasket.Add(new Ticket());
            ChangeTracker.Setup(x => x.CurrentUser).Returns(new AnonymousUser("1", 1));
            Repository.Setup(x => x.GetAllStationAppConfigs()).Returns(new List <StationAppConfigSr>()
            {
                new StationAppConfigSr("CashAcceptorAlwayActive", 1),
                new StationAppConfigSr("AllowAnonymousBetting", 1),
            });

            StationSettings.PrefFileName = "PrefFile.txt";
            StationSettings.Init();
            StationSettings.GetCashInManagerInstance();

            stationRepository.SetCashInDefaultState(10);
            System.Threading.Thread.Sleep(500);
            Assert.AreEqual(StationSettings.IsCashInEnabled, true);
        }
        public void AlwaysActiveDisabled()
        {
            var     stationRepository = new StationRepository();
            decimal reserved;
            decimal factor;

            WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out reserved, out factor)).Returns(10m);

            Repository.Setup(x => x.GetAllStationAppConfigs()).Returns(new List <StationAppConfigSr>()
            {
                new StationAppConfigSr("CashAcceptorAlwayActive", 0),
                new StationAppConfigSr("AllowAnonymousBetting", 1),
            });

            TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>());
            TicketHandler.Object.TicketsInBasket.Add(new Ticket());
            TicketHandler.Object.TicketsInBasket[0].MaxBet = 500;
            ChangeTracker.Object.CurrentUser = new AnonymousUser("1", 1);

            StationSettings StationSettings = new StationSettings();

            StationSettings.PrefFileName = "PrefFile.txt";
            StationSettings.Init();
            StationSettings.GetCashInManagerInstance();


            stationRepository.SetCashInDefaultState(10);
            System.Threading.Thread.Sleep(500);
            Assert.AreEqual(StationSettings.IsCashInEnabled, false);
        }
示例#3
0
 public void NoPreffileTest()
 {
     try
     {
         StationSettings StationSettings = new StationSettings();
         StationSettings.Init();
     }
     catch (FileNotFoundException)
     {
     }
 }
        public void AnonymousNoCashpoolHaveBets()
        {
            var stationRepository = new StationRepository();

            IoCContainer.Kernel.Rebind <IChangeTracker>().To <ChangeTracker>().InSingletonScope();
            var             ChangeTracker   = IoCContainer.Kernel.Get <IChangeTracker>();
            StationSettings StationSettings = new StationSettings();

            IoCContainer.Kernel.Rebind <IStationSettings>().ToConstant(StationSettings).InSingletonScope();

            decimal reserved;
            decimal factor;

            WsdlRepository.Setup(x => x.GetBalance(It.IsAny <uid>(), out reserved, out factor)).Returns(10m);

            TicketHandler.Setup(x => x.TicketsInBasket).Returns(new SyncObservableCollection <Ticket>());
            TicketHandler.Object.TicketsInBasket.Add(new Ticket());
            TicketHandler.Object.TicketsInBasket[0].MaxBet = 500;
            TicketHandler.Object.TicketsInBasket[0].TipItems.Add(new TipItemVw(new TestOdd()
            {
                OutcomeId = 1, OddId = { Value = 1 }, BetDomain = new TestBetDomain()
                {
                    BetDomainId = 1, Match = new TestMatchLn()
                    {
                        MatchId = 1
                    }
                }, Value = { Value = 1.85M }
            }));
            ChangeTracker.CurrentUser = new AnonymousUser("1", 1);
            Repository.Setup(x => x.GetAllStationAppConfigs()).Returns(new List <StationAppConfigSr>()
            {
                new StationAppConfigSr("CashAcceptorAlwayActive", 1),
                new StationAppConfigSr("AllowAnonymousBetting", 1),
            });
            StationSettings.PrefFileName = "PrefFile.txt";
            StationSettings.Init();
            StationSettings.GetCashInManagerInstance();

            stationRepository.SetCashInDefaultState(10);
            System.Threading.Thread.Sleep(500);
            Assert.AreEqual(StationSettings.IsCashInEnabled, true);
        }