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); } }); }
public void EngineShouldGetCorrectMultiplier() { var config = new Configuration(); var multiplier = MultiplierBonusEngine.GetMultiplier(config); Assert.IsTrue(config.BonusConfig.MultiplierSelections.Any(mult => mult == multiplier)); }
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); }
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); }
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); }
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); } }); }
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); }