private void AssertNotClosedNotEditableBetCommon(Bet bet, BetViewModel betViewModel)
        {
            Assert.IsNull(betViewModel.CloseDateAndScreenshot);
            Assert.IsNull(betViewModel.StatusActionImage);
            Assert.AreEqual(0, betViewModel.Result);

            Assert.IsNull(betViewModel.StatusActionImages);
        }
Beispiel #2
0
        private IEnumerable<BetViewModel> GetBetViewModels(IEnumerable<Bet> bets, bool isEditable, bool displayBattle, bool displayUser)
        {
            var betViewModels = new List<BetViewModel>();
            foreach (var bet in bets)
            {
                var betViewModel = new BetViewModel() { BetId = bet.Id };
                betViewModel.IsEditable = isEditable;
                betViewModel.IsClosed = bet.IsClosed;

                betViewModel.IsVisible = true;
                if (!isEditable)
                {
                    if (bet.IsPrivate)
                    {
                        betViewModel.IsVisible = false;
                        betViewModel.InvisibleIconClass = "eye_red";
                        betViewModel.InvisibleIconTitle = Bets.BetIsPrivate;
                    }
                    else if (!bet.IsClosed)
                    {
                        betViewModel.IsVisible = false;
                        betViewModel.InvisibleIconClass = "eye_blek";
                        betViewModel.InvisibleIconTitle = Bets.BetIsNotClosed;
                    }
                }

                if (betViewModel.IsVisible)
                {
                    betViewModel.Title = bet.Title;
                    betViewModel.Url = bet.Url;
                    betViewModel.Amount = bet.Amount;
                    betViewModel.Coefficient = bet.Coefficient;
                }

                betViewModel.OpenDateAndScreenshot = GetDateAndScreenshot(bet.OpenBetScreenshot, betViewModel.IsVisible);

                if (bet.IsClosed)
                {
                    betViewModel.CloseDateAndScreenshot = GetDateAndScreenshot(bet.CloseBetScreenshot, betViewModel.IsVisible);
                    betViewModel.StatusActionImage = GeBetStatusImage(bet.Id, bet.StatusEnum);
                    betViewModel.Result = bet.Result.Value;
                }
                else if (isEditable)
                    betViewModel.StatusActionImages = GetBetStatusImages(bet.Id);

                if (displayBattle)
                {
                    
                }

                if (displayUser)
                {
                    
                }

                betViewModels.Add(betViewModel);
            }

            return betViewModels;
        }
        private void AssertNotVisibleBetCommon(Bet bet, bool isClosed, bool isEditable, string invisibleIconClass, string invisibleIconTitle, BetViewModel betViewModel)
        {
            Assert.AreEqual(bet.Id, betViewModel.BetId);
            Assert.IsNull(betViewModel.Title);
            Assert.IsNull(betViewModel.Url);
            Assert.AreEqual(0, betViewModel.Amount);
            Assert.AreEqual(0, betViewModel.Coefficient);

            Assert.AreEqual(isClosed, betViewModel.IsClosed);
            Assert.AreEqual(isEditable, betViewModel.IsEditable);

            Assert.IsFalse(betViewModel.IsVisible);
            Assert.AreEqual(invisibleIconClass, betViewModel.InvisibleIconClass);
            Assert.AreEqual(invisibleIconTitle, betViewModel.InvisibleIconTitle);

            AssertNotVisibleDateAndScreenshot(bet.OpenBetScreenshot.CreationDateTime, betViewModel.OpenDateAndScreenshot);
        }
        private void AssertClosedBetCommon(Bet bet, bool visible, BetViewModel betViewModel)
        {
            if (visible)
                AssertVisibleDateAndScreenshot(bet.CloseBetScreenshot.CreationDateTime, Bets.MakingScreenshot, "sc_inprogress", null, betViewModel.CloseDateAndScreenshot);
            else
                AssertNotVisibleDateAndScreenshot(bet.CloseBetScreenshot.CreationDateTime, betViewModel.CloseDateAndScreenshot);
            AssertSucceedStatusActionImage(bet.Id, betViewModel.StatusActionImage);
            Assert.AreEqual(bet.Result, betViewModel.Result);

            Assert.IsNull(betViewModel.StatusActionImages);
        }
 private void AssertClosedPublicTeamBet(Bet bet, BetViewModel betViewModel)
 {
     AssertClosedPublicUserBet(bet, betViewModel);
     //ToDo: Add user and battle validation
 }
        private void AssertVisibleBetCommon(Bet bet, bool isClosed, bool isEditable, BetViewModel betViewModel)
        {
            Assert.AreEqual(bet.Id, betViewModel.BetId);
            Assert.AreEqual(bet.Title, betViewModel.Title);
            Assert.AreEqual(bet.Url, betViewModel.Url);
            Assert.AreEqual(bet.Amount, betViewModel.Amount);
            Assert.AreEqual(bet.Coefficient, betViewModel.Coefficient);

            Assert.AreEqual(isClosed, betViewModel.IsClosed);
            Assert.AreEqual(isEditable, betViewModel.IsEditable);

            Assert.IsTrue(betViewModel.IsVisible);
            Assert.IsNull(betViewModel.InvisibleIconClass);

            AssertVisibleDateAndScreenshot(bet.OpenBetScreenshot.CreationDateTime, Bets.MakingScreenshot, "sc_inprogress", null, betViewModel.OpenDateAndScreenshot);
        }
        private void AssertClosedPublicUserBet(Bet bet, BetViewModel betViewModel)
        {
            AssertVisibleBetCommon(bet, true, false, betViewModel);

            AssertClosedBetCommon(bet, true, betViewModel);
        }
 private void AssertOpenedPrivateTeamBet(Bet beet, BetViewModel betViewModel)
 {
     AssertOpenedPrivateUserBet(beet, betViewModel);
     //ToDo: Add Battle and User validation
 }
        private void AssertClosedPrivateUserBet(Bet bet, BetViewModel betViewModel)
        {
            AssertNotVisibleBetCommon(bet, true, false, "eye_red", Bets.BetIsPrivate, betViewModel);

            AssertClosedBetCommon(bet, false, betViewModel);
        }
        private void AssertOpenedPublicUserBet(Bet bet, BetViewModel betViewModel)
        {
            AssertNotVisibleBetCommon(bet, false, false, "eye_blek", Bets.BetIsNotClosed, betViewModel);

            AssertNotClosedNotEditableBetCommon(bet, betViewModel);
        }
 private void AssertClosedMyBet(Bet bet, BetViewModel betViewModel)
 {
     AssertClosedMyBattleBet(bet, betViewModel);
     //ToDo: Add battle-related properties validation
 }
        private void AssertClosedMyBattleBet(Bet bet, BetViewModel betViewModel)
        {
            AssertVisibleBetCommon(bet, true, true, betViewModel);

            AssertClosedBetCommon(bet, true, betViewModel);
        }
        private void AssertOpenedMyBattleBet(Bet bet, BetViewModel betViewModel)
        {
            AssertVisibleBetCommon(bet, false, true, betViewModel);

            AssertNotClosedEditableBetCommon(bet, betViewModel);
        }