Exemple #1
0
        public void NoResultsTest()
        {
            var model = new SearchViewModel();

            ChangeTracker.Setup(x => x.SearchMatches).Returns(new SortableObservableCollection <IMatchVw>());
            ChangeTracker.Setup(x => x.AllResults).Returns(new SortableObservableCollection <IMatchVw>());
            ChangeTracker.Setup(x => x.SearchString).Returns("2222");
            TranslationProvider.Setup(x => x.Translate(MultistringTags.TERMINAL_FORM_NO_MATCH_FOUND)).Returns("not found");
            TranslationProvider.Setup(x => x.Translate(MultistringTags.TERMINAL_FORM_SEARCH_STRING_TOO_SHORT)).Returns("not found");
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>()
            {
                TestMatchVw.CreateMatch(1)
            };

            Repository.Setup(x => x.FindMatches(It.IsAny <SortableObservableCollection <IMatchVw> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <LineSr.DelegateFilterMatches>(), It.IsAny <Comparison <IMatchVw> >())).Returns(collection);
            model.PleaseWaitSearch();
            Repository.Verify(x => x.FindMatches(It.IsAny <SortableObservableCollection <IMatchVw> >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <LineSr.DelegateFilterMatches>(), It.IsAny <Comparison <IMatchVw> >()), Times.Once);

            TranslationProvider.Verify(x => x.Translate(MultistringTags.TERMINAL_FORM_NO_MATCH_FOUND), Times.Once);
            TranslationProvider.Verify(x => x.Translate(MultistringTags.TERMINAL_FORM_SEARCH_STRING_TOO_SHORT), Times.Never);
        }
        private IMatchVw CreateMatch(int index, bool outright = false)
        {
            TestGroupVw tournamentView = new TestGroupVw()
            {
                DisplayName = "test" + index,
            };

            tournamentView.LineObject = new GroupLn()
            {
                GroupId = index,
            };
            var match = new TestMatchVw()
            {
                TournamentView = tournamentView,
                StartDate      = DateTime.Now.AddDays(5),
                ExpiryDate     = DateTime.Now.AddDays(5),
                IsOutright     = outright,
            };

            return(match);
        }
Exemple #3
0
        public void OpenBasketTest()
        {
            AuthorizationService = MockRepository.GenerateStub <IAuthorizationService>();
            StationRepository    = MockRepository.GenerateStub <IStationRepository>();
            LanguageRepository   = MockRepository.GenerateStub <ILanguageRepository>();
            LineProvider         = MockRepository.GenerateStub <ILineProvider>();
            BusinessPropsHelper  = MockRepository.GenerateStub <IBusinessPropsHelper>();
            DataBinding          = MockRepository.GenerateStub <IDataBinding>();


            IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope();
            IoCContainer.Kernel.Bind <IAuthorizationService>().ToConstant <IAuthorizationService>(AuthorizationService).InSingletonScope();
            IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(StationRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILanguageRepository>().ToConstant <ILanguageRepository>(LanguageRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILineProvider>().ToConstant <ILineProvider>(LineProvider).InSingletonScope();
            IoCContainer.Kernel.Bind <IBusinessPropsHelper>().ToConstant <IBusinessPropsHelper>(BusinessPropsHelper).InSingletonScope();


            DataBinding.Expect(x => x.TipListInfo).Return(new TipListInfo());



            Ticket ticket = new Ticket();

            ticket.Stake = 10;
            var matchVw = new TestMatchVw()
            {
                HomeCompetitorName   = "Home competitor",
                AwayCompetitorName   = "Away competitor",
                TournamentNameToShow = "tournament",
                IsEnabled            = true,
                LiveScore            = "0:0(1:1)",
                VisibleOddCount      = 120,
            };
            var match = new TestMatchLn()
            {
                MatchView = matchVw,
                MatchId   = 1
            };
            var betdomainVw = new TestBetDomainVw()
            {
                IsEnabled = true,
            };
            var betdomain = new TestBetDomain()
            {
                BetDomainId   = 1,
                Match         = match,
                BetDomainView = betdomainVw
            };
            var oddVw = new TestOddVw()
            {
                DisplayName = "sel 1",
                Value       = 100.21m
            };
            var testOdd = new TestOdd()
            {
                OutcomeId = 1,
                OddId     = { Value = 1 },
                BetDomain = betdomain,
                Value     = { Value = 1.85M },
                OddView   = oddVw,
            };
            var tipitem = new TestTipItem(testOdd)
            {
                IsEnabled      = true,
                BetDomainName  = "Total (2.5)",
                IsBankEnabled  = true,
                IsBank         = true,
                IsBankEditable = true,
            };
            var tipitem2 = new TestTipItem(testOdd)
            {
                IsEnabled     = false,
                BetDomainName = "Total (2.5)",
                IsChecked     = true,
            };

            ticket.TipItems.Add(tipitem);
            ticket.TipItems.Add(tipitem2);



            StationRepository.TurnOffCashInInit = true;
            StationRepository.Expect(x => x.AllowAnonymousBetting).Return(true);
            StationRepository.Expect(x => x.IsReady).Return(true);
            StationRepository.Expect(x => x.StationNumber).Return("0024");
            StationRepository.Expect(x => x.HubSettings).Return(new Dictionary <string, string>());
            StationRepository.Currency = "EUR";

            ChangeTracker                           = IoCContainer.Kernel.Get <IChangeTracker>();
            ChangeTracker.CurrentUser               = new AnonymousUser("1", 1);
            ChangeTracker.CurrentUser.Cashpool      = 100000;
            ChangeTracker.CurrentUser.AvailableCash = 100000;



            Dispatcher.Invoke(() =>
            {
                Window = MyRegionManager.FindWindowByViewModel <BasketViewModel>();
                Window.Show();
            });

            Thread.Sleep(1000);

            Dispatcher.Invoke(() =>
            {
                Window.Close();
            });
        }
Exemple #4
0
        public void Openlive2Test()
        {
            DataBinding          = MockRepository.GenerateStub <IDataBinding>();
            AuthorizationService = MockRepository.GenerateStub <IAuthorizationService>();
            StationRepository    = MockRepository.GenerateStub <IStationRepository>();
            LanguageRepository   = MockRepository.GenerateStub <ILanguageRepository>();
            LineProvider         = MockRepository.GenerateStub <ILineProvider>();
            BusinessPropsHelper  = MockRepository.GenerateStub <IBusinessPropsHelper>();
            IoCContainer.Kernel.Bind <IDataBinding>().ToConstant <IDataBinding>(DataBinding).InSingletonScope();
            IoCContainer.Kernel.Bind <IAuthorizationService>().ToConstant <IAuthorizationService>(AuthorizationService).InSingletonScope();
            IoCContainer.Kernel.Bind <IStationRepository>().ToConstant <IStationRepository>(StationRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILanguageRepository>().ToConstant <ILanguageRepository>(LanguageRepository).InSingletonScope();
            IoCContainer.Kernel.Bind <ILineProvider>().ToConstant <ILineProvider>(LineProvider).InSingletonScope();
            IoCContainer.Kernel.Bind <IBusinessPropsHelper>().ToConstant <IBusinessPropsHelper>(BusinessPropsHelper).InSingletonScope();



            StationRepository.TurnOffCashInInit = true;
            StationRepository.Expect(x => x.IsReady).Return(true);
            StationRepository.Expect(x => x.StationNumber).Return("0024");
            StationRepository.Expect(x => x.SyncInterval).Return(20000);
            StationRepository.Expect(x => x.HubSettings).Return(new Dictionary <string, string>());



            Dispatcher.Invoke(() =>
            {
                Window = MyRegionManager.FindWindowByViewModel <MainViewModel>();
                Window.Show();
            });

            var start = DateTime.Now;
            //var match = new MatchVw(new MatchLn());
            var match  = TestMatchVw.CreateMatch(1, true);
            var match2 = TestMatchVw.CreateMatch(2, true);
            var match3 = TestMatchVw.CreateMatch(3, true);
            var match4 = TestMatchVw.CreateMatch(4, true);
            var match5 = TestMatchVw.CreateMatch(5, true);

            ((TestMatchVw)match).SportDescriptor    = SportSr.SPORT_DESCRIPTOR_TENNIS;
            ((TestMatchVw)match).AllEnabledOddCount = 10;
            ((TestMatchVw)match).LiveColor          = "#AAd01f00";
            ((TestMatchVw)match).LivePeriodInfo     = eLivePeriodInfo.Tennis_1st_Set;

            ((TestMatchVw)match2).IsHeader             = true;
            ((TestMatchVw)match2).LiveBetStatus        = eMatchStatus.Started;
            ((TestMatchVw)match2).LivePeriodInfo       = eLivePeriodInfo.Tennis_1st_Set;
            ((TestMatchVw)match2).SportDescriptor      = SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY;
            ((TestMatchVw)match2).ShomMinutes          = Visibility.Visible;
            ((TestMatchVw)match2).LivePeriodInfoString = "10";
            ((TestMatchVw)match2).AllEnabledOddCount   = 10;

            ((TestMatchVw)match3).StartDate          = DateTime.Now.AddDays(1);
            ((TestMatchVw)match3).SportDescriptor    = SportSr.SPORT_DESCRIPTOR_SOCCER;
            ((TestMatchVw)match3).AllEnabledOddCount = 10;

            ((TestMatchVw)match4).IsEnabled            = false;
            ((TestMatchVw)match4).LiveBetStatus        = eMatchStatus.Started;
            ((TestMatchVw)match4).LivePeriodInfo       = eLivePeriodInfo.Interrupted;
            ((TestMatchVw)match4).SportDescriptor      = SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY;
            ((TestMatchVw)match4).ShomMinutes          = Visibility.Visible;
            ((TestMatchVw)match4).LivePeriodInfoString = "10";
            ((TestMatchVw)match4).AllEnabledOddCount   = 10;

            ((TestMatchVw)match5).LiveBetStatus        = eMatchStatus.Started;
            ((TestMatchVw)match5).LivePeriodInfo       = eLivePeriodInfo.Interrupted;
            ((TestMatchVw)match5).SportDescriptor      = SportSr.SPORT_DESCRIPTOR_SOCCER;
            ((TestMatchVw)match5).ShomMinutes          = Visibility.Visible;
            ((TestMatchVw)match5).LivePeriodInfoString = "10";
            ((TestMatchVw)match5).AllEnabledOddCount   = 10;

            var matches = new SortableObservableCollection <IMatchVw>()
            {
                match,
                match,
                match2,
                match2,
                match5,
                match5,
                match4,
                match4,
                match3,
                match3,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
                match,
            };

            Repository.BackToRecord();

            Repository.Expect(x => x.FindMatches(null, null, null, null, null)).Return(matches).IgnoreArguments();
            Repository.Replay();
            var userManagementViewModel = MyRegionManager.NavigateUsingViewModel <LiveViewModel>(RegionNames.ContentRegion);

            while (userManagementViewModel.IsReady)
            {
                Thread.Sleep(1);
            }
            Console.WriteLine(DateTime.Now - start);

            Thread.Sleep(100000);

            Dispatcher.Invoke(() =>
            {
                Window.Close();
            });
        }