Exemplo n.º 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);
                    }
            });
        }
Exemplo n.º 2
0
        public decimal EngineShouldCalculateCorrectWin(int symbol, decimal totalBet, int multiplier)
        {
            var config   = new Configuration();
            var totalWin = MultiplierBonusEngine.CalculateWin(symbol, totalBet, multiplier, config);

            return(totalWin);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
                }
            });
        }
Exemplo n.º 7
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);
        }