예제 #1
0
        public void TestFreeSpinFeature()
        {
            // arrange
            var user        = new UserGameKey(-1, 51);
            var userSession = new UserSession
            {
                SessionKey = "unittest",
                UserId     = -1
            };
            var bet = new SpinBet(user, PlatformType.None)
            {
                Lines      = 50,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Cleopatra", PlatformType.None)
            {
                GameSetting = new GameSetting {
                    GameSettingGroupId = 1
                },
                Query = new QueryCollection {
                },
            };

            requestBonusContext.UserSession = userSession;
            requestBonusContext.UserGameKey = user;
            var bonusContext = new BonusStateContext(1, new CleopatraBonus {
                SpinBet = bet
            });
            var state = new FreeSpinState(1, 0);

            //Action
            var response    = state.Handle(requestBonusContext, bonusContext);
            var result      = response.result;
            var responseXml = xmlhelper.Serialize(result.ToResponseXml(ResponseXmlFormat.None));
            var element     = XElement.Parse(responseXml, LoadOptions.PreserveWhitespace);

            // Assert
            Assert.IsNotNull(element);
            Assert.IsTrue(element.Element("data").Element("spin").Element("wheels") != null);
            Assert.AreEqual(result.Win, decimal.Parse(element.Element("win").Value));
            Assert.AreEqual(result.Win > 0, element.Element("data").Element("spin").Element("winposition").Descendants().Count() > 0);
            Assert.AreEqual(result.SpinResult.HasBonus, !string.IsNullOrEmpty(element.Element("data").Element("spin").Element("bonus").Value));
            Assert.AreEqual(result.SpinResult.HasBonus, element.Element("data").Element("spin").Element("bonusposition").Descendants().Count() > 0);
        }
예제 #2
0
        public void TestFreeSpinFeature()
        {
            // arrange
            var user        = new UserGameKey(-1, 51);
            var userSession = new UserSession
            {
                SessionKey = "unittest",
                UserId     = -1
            };
            var bet = new SpinBet(user, PlatformType.None)
            {
                Lines      = 50,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Cleopatra", PlatformType.None)
            {
                GameSetting = new GameSetting {
                    GameSettingGroupId = 1
                },
                Query = new QueryCollection {
                },
            };

            requestBonusContext.UserSession = userSession;
            requestBonusContext.UserGameKey = user;
            var bonusContext = new BonusStateContext(1, new CleopatraBonus {
                SpinBet = bet
            });
            var state = new FreeSpinState(1, 0);

            //Action
            var reponse = state.Handle(requestBonusContext, bonusContext);

            // Assert
            Assert.AreEqual(!reponse.result.SpinResult.HasBonus, reponse.nextState.IsCompleted);
            Assert.AreEqual(!reponse.result.SpinResult.HasBonus, reponse.nextState is FreeSpinState);
            Assert.AreEqual(reponse.result.SpinResult.HasBonus, reponse.nextState is SarchophagusState);
        }