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); }
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(); }); }