Пример #1
0
        public IHandHistoriesViewModel InitializeWith(
            IEnumerable <IConvertedPokerHand> convertedPokerHands, int itemsPerPage)
        {
            var handHistoryViewModels = new List <IHandHistoryViewModel>();

            if (string.IsNullOrEmpty(_handHistoriesFilter.HeroName) && convertedPokerHands.Count() > 0 &&
                !string.IsNullOrEmpty(convertedPokerHands.First().HeroName))
            {
                _handHistoriesFilter.HeroName = convertedPokerHands.First().HeroName;
            }

            foreach (IConvertedPokerHand hand in convertedPokerHands)
            {
                IHandHistoryViewModel handHistoryViewModel = _handHistoryViewModelMake.New;

                handHistoryViewModel
                .InitializeWith(_handHistoriesFilter.ShowPreflopFolds)
                .UpdateWith(hand);

                handHistoryViewModels.Add(handHistoryViewModel);
            }

            _itemsPagesManager.InitializeWith((uint)itemsPerPage, handHistoryViewModels);

            ConnectToHandHistoryFilterEvents();

            UpdatePageInfo();

            return(this);
        }
Пример #2
0
        public void AddsOnlyActivePlayersToRows_ByDefault()
        {
            _handHistoryViewModel = new HandHistoryViewModel();
            _handHistoryViewModel.UpdateWith(_pokerHand);

            Assert.That(_handHistoryViewModel.PlayerRows.Count, Is.EqualTo(4));
        }
Пример #3
0
        public void AddsAllPlayersToRows_IfShowPreflopFoldsIsRequested()
        {
            _handHistoryViewModel = new HandHistoryViewModel().InitializeWith(true);
            _handHistoryViewModel.UpdateWith(_pokerHand);

            Assert.That(_handHistoryViewModel.PlayerRows.Count, Is.EqualTo(6));
        }
Пример #4
0
        public void CreatesBoardViewModelAndUpdatesItOnUpdate()
        {
            _pokerHand.Board = "As Kh Qd";

            var board = new BoardViewModel();

            board.UpdateWith(_pokerHand.Board);

            _handHistoryViewModel = new HandHistoryViewModel();
            _handHistoryViewModel.UpdateWith(_pokerHand);

            Assert.That(_handHistoryViewModel.Board, Is.EqualTo(board));
        }
Пример #5
0
        public void CreatesHeaderCorrectly()
        {
            _handHistoryViewModel = new HandHistoryViewModel();
            _handHistoryViewModel.UpdateWith(_pokerHand);

            Assert.That(_handHistoryViewModel.TournamentId, Is.EqualTo(_pokerHand.TournamentId.ToString()));
            Assert.That(_handHistoryViewModel.GameId, Is.EqualTo(_pokerHand.GameId.ToString()));
            Assert.That(_handHistoryViewModel.BigBlind, Is.EqualTo(_pokerHand.BB.ToString()));
            Assert.That(_handHistoryViewModel.SmallBlind, Is.EqualTo(_pokerHand.SB.ToString()));
            Assert.That(_handHistoryViewModel.Ante, Is.EqualTo(_pokerHand.Ante.ToString()));
            Assert.That(_handHistoryViewModel.TotalPlayers, Is.EqualTo(_pokerHand.TotalPlayers.ToString()));
            Assert.That(_handHistoryViewModel.TimeStamp, Is.EqualTo(_pokerHand.TimeStamp.ToString()));
        }
Пример #6
0
        public void AdjustToConditionAction_ConditionIsFullFilledReturnsTrue_SetsVisibleToTrue()
        {
            _handHistoryViewModel = new HandHistoryViewModel {
                Visible = false
            };

            var conditionStub = new StubCondition {
                FullFill = true
            };

            _handHistoryViewModel.AdjustToConditionAction.Invoke(conditionStub);

            Assert.That(_handHistoryViewModel.Visible, Is.True);
        }
        public GameHistoryViewModel(
            ISettings settings,
            IDimensionsViewModel dimensions,
            IHandHistoryViewModel handHistoryViewModel,
            IDispatcherTimer scrollToNewestHandTimer,
            ICollectionValidator collectionValidator)
        {
            _settings                = settings;
            CurrentHandHistory       = handHistoryViewModel;
            _scrollToNewestHandTimer = scrollToNewestHandTimer;
            _collectionValidator     = collectionValidator;

            Dimensions = dimensions.InitializeWith(settings.RetrieveRectangle(DimensionsKey, new Rectangle(0, 0, 600, 200)));

            _convertedHands = new List <IConvertedPokerHand>();

            RegisterEvents();
        }
Пример #8
0
 public RepositoryHandBrowserViewModel(IRepositoryHandBrowser repositoryHandBrowser, IHandHistoryViewModel handHistoryViewModel, ICollectionValidator collectionValidator)
 {
     CurrentHandHistory     = handHistoryViewModel;
     _repositoryHandBrowser = repositoryHandBrowser;
     _collectionValidator   = collectionValidator;
 }