public void SingleToMultyTest() { IoCContainer.Kernel.Unbind <IChangeTracker>(); IoCContainer.Kernel.Bind <IChangeTracker>().To <ChangeTracker>().InSingletonScope(); var ChangeTracker = IoCContainer.Kernel.Get <IChangeTracker>(); IoCContainer.Kernel.Unbind <ITicketHandler>(); IoCContainer.Kernel.Bind <ITicketHandler>().To <TicketHandler>().InSingletonScope(); var TicketHandler = IoCContainer.Kernel.Get <ITicketHandler>(); StationRepository.Setup(x => x.IsReady).Returns(true); StationRepository.Setup(x => x.GetMaxWinSingleBet(It.IsAny <Ticket>())).Returns(5000); StationRepository.Setup(x => x.GetMaxStakeSingleBet(It.IsAny <Ticket>())).Returns(5000); StationRepository.Setup(x => x.GetMaxSystemBet(It.IsAny <Ticket>())).Returns(5000); var testOdd = new TestOdd() { OddId = { Value = 1 }, BetDomain = new TestBetDomain() { Match = new TestMatchLn() { MatchId = 1 } }, Value = { Value = 1 }, OutcomeId = 1 }; ChangeTracker.CurrentUser = new LoggedInUser(0, "", 100, 10, 10, 10); var model = new BaseViewModel(); model.PlaceBetMethod(new TipItemVw(testOdd)); Assert.AreEqual(TicketHandler.TicketState, TicketStates.Single); model.PlaceBetMethod(new TipItemVw(new TestOdd() { OddId = { Value = 2 }, BetDomain = new TestBetDomain() { Match = new TestMatchLn() { MatchId = 2 } }, Value = { Value = 2 }, OutcomeId = 2 })); Assert.AreEqual(TicketHandler.TicketState, TicketStates.Multy); Assert.AreEqual(TicketHandler.TicketsInBasket.Count, 1); Assert.AreEqual(TicketHandler.TicketsInBasket[0].TipItems.Count, 2); }
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(); }); }