示例#1
0
        public void EngineShouldWriteXmlOfRevealBonusResultXml(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);
            var totalWin       = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config);

            bonus.UpdateBonus(multiplier);

            var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin);
            var xElement = multiplierBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                var responseXml = new MultiplierBonusXml();
                using (var xmlReader = xElement.CreateReader())
                {
                    responseXml.ReadXml(xmlReader);
                }

                using (var memStream = new MemoryStream())
                    using (var xmlWriter = XmlWriter.Create(memStream, new XmlWriterSettings()
                    {
                        ConformanceLevel = ConformanceLevel.Auto
                    }))
                    {
                        xmlWriter.WriteStartElement("bonus");
                        responseXml.WriteXml(xmlWriter);
                    }
            });
        }
示例#2
0
        public void EngineShouldGetCorrectMultiplier()
        {
            var config     = new Configuration();
            var multiplier = MultiplierBonusEngine.GetMultiplier(config);

            Assert.IsTrue(config.BonusConfig.MultiplierSelections.Any(mult => mult == multiplier));
        }
示例#3
0
        public void EngineShouldCompleteMultiplierBonusWithZeroCounter(int gameId, int level)
        {
            var config          = new Configuration();
            var spinResult      = GenerateWithMultiplierSpinResult(level);
            var requestContext  = GetMockBonusRequestContext(0, gameId);
            var multiplierBonus = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier      = MultiplierBonusEngine.GetMultiplier(config);

            multiplierBonus.UpdateBonus(multiplier);

            Assert.IsTrue(multiplierBonus.IsCompleted);
        }
示例#4
0
        public void EngineShouldCreateMultiplierBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var symbol         = spinResult.BonusPositions.First().Symbol;
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);

            bonus.UpdateBonus(multiplier);
            var totalWin = MultiplierBonusEngine.CalculateWin(symbol, bonus.TotalBet, multiplier, config);

            Assert.DoesNotThrow(() => MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin));
        }
        public void EngineShouldCompleteMultiplierBonusResultOnBonusCompletion(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);
            var totalWin       = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config);

            bonus.UpdateBonus(multiplier);

            var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin);

            Assert.IsTrue(multiplierBonusResult.IsCompleted);
        }
示例#6
0
        public void EngineShouldCreateBonusResponseXmlOfRevealBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);
            var totalWin       = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config);

            bonus.UpdateBonus(multiplier);

            var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin);
            var responseXml           = multiplierBonusResult.ToResponseXml(ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
示例#7
0
        public void EngineShouldReadResponseXmlOfRevealBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);
            var totalWin       = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config);

            bonus.UpdateBonus(multiplier);

            var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin);
            var xElement = multiplierBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new MultiplierBonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
示例#8
0
        public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithMultiplierSpinResult(level);
            var bonus          = MultiplierBonusEngine.CreateMultiplierBonus(spinResult);
            var multiplier     = MultiplierBonusEngine.GetMultiplier(config);
            var totalWin       = MultiplierBonusEngine.CalculateWin(spinResult.BonusPositions.First().Symbol, 1, multiplier, config);

            bonus.UpdateBonus(multiplier);

            var multiplierBonusResult = MultiplierBonusEngine.CreateMultiplierBonusResult(bonus, totalWin);
            var xElement    = multiplierBonusResult.ToXElement();
            var responseXml = new MultiplierBonusXml();

            using (var xmlReader = xElement.CreateReader())
            {
                responseXml.ReadXml(xmlReader);
            }

            Assert.IsNull(responseXml.GetSchema());
            Assert.AreEqual(multiplierBonusResult.Win, responseXml.Win);
            Assert.AreEqual(multiplierBonusResult.Multiplier, responseXml.Multiplier);
        }