public void EngineShouldWriteXmlOfrespinBonusResultXml(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);
            var xElement          = respinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                var responseXml = new RespinBonusXml();
                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);
                    }
            });
        }
        public void EngineShouldCreateRespinBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var spinResult     = GenerateWithRespinSpinResult(level);
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);

            bonus.UpdateBonus(respinResult);


            Assert.DoesNotThrow(() => RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult));
        }
        public void EngineShouldCompleteRespinBonusResultOnBonusCompletion(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);

            Assert.IsTrue(respinBonusResult.IsCompleted);
        }
        public void EngineShouldCreateRespinBonusResultWithSameGameResultAndBonus(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);

            Assert.AreSame(respinBonusResult.Bonus, bonus);
        }
        public void EngineShouldCreateBonusResponseXmlOfrespinBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);
            var responseXml       = respinBonusResult.ToResponseXml(ResponseXmlFormat.History);

            Assert.IsNotNull(responseXml);
        }
        public void EngineShouldCreateBonusXElementOfrespinBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);
            var xElement          = respinBonusResult.ToXElement();

            Assert.IsNotNull(xElement);
        }
        public void EngineShouldReadResponseXmlOfrespinBonusResult(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);
            var xElement          = respinBonusResult.ToXElement();

            Assert.DoesNotThrow(() =>
            {
                using (var xmlReader = xElement.CreateReader())
                {
                    var responseXml = new RespinBonusXml();
                    responseXml.ReadXml(xmlReader);
                }
            });
        }
        public void EngineShouldCopyBonusValuesFromResultToXml(int gameId, int level)
        {
            var config         = new Configuration();
            var requestContext = GetMockBonusRequestContext(0, gameId);
            var spinResult     = GenerateWithRespinSpinResult(level);
            var respinResult   = RespinBonusEngine.CreateRespinResult(spinResult, level, requestContext, config);
            var bonus          = RespinBonusEngine.CreateRespinBonus(spinResult);

            bonus.UpdateBonus(respinResult);

            var respinBonusResult = RespinBonusEngine.CreateRespinBonusResult(bonus, respinResult);
            var xElement          = respinBonusResult.ToXElement();
            var responseXml       = new RespinBonusXml();

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

            Assert.IsNull(responseXml.GetSchema());
            Assert.AreEqual(respinBonusResult.Win, responseXml.TotalWin);
            Assert.AreEqual(0, responseXml.Counter);
            Assert.AreEqual(1, responseXml.NumberOfFreeSpin);
        }