public void TestExecuteBonus() { // Arrange var user = new UserGameKey(-1, 104); var spinResult = new Games.DragonRiches.DragonRichesResult(); var reels = new List <int[]> { new[] { 0, 6, 10 }, new[] { 6, 9, 12 }, new[] { 6, 9, 13 }, new[] { 9, 11, 12, }, new[] { 12, 10, 13 } }; spinResult.Bonus = new Stake(Guid.NewGuid(), 3); spinResult.Bonus.Count = 6; spinResult.Wheel = new Games.DragonRiches.DragonRichesWheel(); spinResult.BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 1, 0 } } }; spinResult.SpinBet = new SpinBet(user, PlatformType.None) { Lines = 30, LineBet = 1.0m }; var userSession = new UserSession { SessionKey = "unittest", UserId = -1 }; var requestContext = new RequestContext <SpinArgs>("simulation", "Dragon Riches", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, Game = new Game { Id = 104 } }; var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Dragon Riches", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; requestBonusContext.UserSession = userSession; requestBonusContext.UserGameKey = user; var bonus = module.CreateBonus(spinResult).Value; var entity = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus), BonusType = bonus.GetType().Name, Version = 3, IsOptional = bonus.IsOptional, IsStarted = bonus.IsStarted, RoundId = 1, BetReference = "" }; // action var result = module.ExecuteBonus(1, entity, requestBonusContext).Value as Games.DragonRiches.DragonRichesBonusSpinResult; // assert Assert.NotNull(result); //Assert.AreEqual(true, ((DragonRichesBonus)result.Bonus).State.IsFreeSpin); }
public void TestExecuteBonus() { // Arrange var user = new UserGameKey(-1, 3); var spinBet = new SpinBet(user, PlatformType.None) { Lines = 30, LineBet = 1.0m }; var result1 = new BikiniBeachResult() { BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 2, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 2) { Count = 1 } }; var result2 = new BikiniBeachResult() { BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 2, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 3) { Count = 1 } }; var result3 = new BikiniBeachResult() { BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 2, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 4) { Count = 1 } }; result1.SpinBet = spinBet; result2.SpinBet = spinBet; result3.SpinBet = spinBet; var userSession = new UserSession { SessionKey = "unittest", UserId = -1 }; var requestContext = new RequestContext <SpinArgs>("simulation", "Bikini Beach", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, Game = new Game { Id = 3 } }; var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Bikini Beach", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; requestBonusContext.UserSession = userSession; requestBonusContext.UserGameKey = user; var bonus1 = module.CreateBonus(result1).Value; var bonus2 = module.CreateBonus(result2).Value; var bonus3 = module.CreateBonus(result3).Value; var entity1 = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus1.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus1), BonusType = bonus1.GetType().Name, Version = 3, IsOptional = bonus1.IsOptional, IsStarted = bonus1.IsStarted, RoundId = 1, BetReference = "" }; var entity2 = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus2.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus2), BonusType = bonus2.GetType().Name, Version = 3, IsOptional = bonus2.IsOptional, IsStarted = bonus2.IsStarted, RoundId = 1, BetReference = "" }; var entity3 = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus3.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus3), BonusType = bonus3.GetType().Name, Version = 3, IsOptional = bonus3.IsOptional, IsStarted = bonus3.IsStarted, RoundId = 1, BetReference = "" }; // action var freeSpinResult1 = module.ExecuteBonus(1, entity1, requestBonusContext).Value as BikiniBeachBonusSpinResult; var freeSpinResult2 = module.ExecuteBonus(1, entity2, requestBonusContext).Value as BikiniBeachBonusSpinResult; var freeSpinResult3 = module.ExecuteBonus(1, entity3, requestBonusContext).Value as BikiniBeachBonusSpinResult; // assert Assert.NotNull(freeSpinResult1); Assert.NotNull(freeSpinResult2); Assert.NotNull(freeSpinResult3); Assert.AreEqual(freeSpinResult1.SpinResult.HasBonus == false, ((BikiniBeachBonus)freeSpinResult1.Bonus).State is Finish); Assert.AreEqual(freeSpinResult2.SpinResult.HasBonus == false, ((BikiniBeachBonus)freeSpinResult1.Bonus).State is Finish); Assert.AreEqual(freeSpinResult3.SpinResult.HasBonus == false, ((BikiniBeachBonus)freeSpinResult1.Bonus).State is Finish); Assert.AreEqual(freeSpinResult1.GameResultType, GameResultType.FreeSpinResult); Assert.AreEqual(freeSpinResult2.GameResultType, GameResultType.RevealResult); Assert.AreEqual(freeSpinResult3.GameResultType, GameResultType.RevealResult); }
public void TestExecuteBonus() { // Arrange var user = new UserGameKey(-1, 80); var result = new GeniesLuckResult() { BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 2, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 3) { Count = 1 } }; result.SpinBet = new SpinBet(user, PlatformType.None) { Lines = 40, LineBet = 1.0m }; var userSession = new UserSession { SessionKey = "unittest", UserId = -1 }; var requestContext = new RequestContext <SpinArgs>("simulation", "Genies Luck", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, Game = new Game { Id = 80 } }; var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Genies Luck", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; requestBonusContext.UserSession = userSession; requestBonusContext.UserGameKey = user; var bonus = module.CreateBonus(result).Value; var entity = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus), BonusType = bonus.GetType().Name, Version = 3, IsOptional = bonus.IsOptional, IsStarted = bonus.IsStarted, RoundId = 1, BetReference = "" }; // action var respinResult = module.ExecuteBonus(1, entity, requestBonusContext).Value as GeniesLuckBonusSpinResult; // assert Assert.NotNull(respinResult); Assert.AreEqual(respinResult.SpinResult.HasBonus == false, ((GeniesLuckBonus)respinResult.Bonus).State is Finish); Assert.AreEqual(respinResult.GameResultType, GameResultType.FreeSpinResult); }
public void TestExecuteBonus() { // Arrange var user = new UserGameKey(-1, 109); var spinBet = new SpinBet(user, PlatformType.None) { Lines = 30, LineBet = 1.0m }; var wheel = new FortuneChimesWheel { Reels = new List <int[]> { new int[] { 1, 1, 1 }, new int[] { 2, 10, 2 }, new int[] { 3, 10, 3 }, new int[] { 4, 10, 4 }, new int[] { 5, 5, 5 }, }, Indices = new int[] { 0, 0, 0, 0, 0 } }; var result1 = new FortuneChimesSpinResult(user) { Wheel = wheel, BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 2, 2, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 3) { Count = 1 } }; result1.SpinBet = spinBet; var userSession = new UserSession { SessionKey = "unittest", UserId = -1 }; var requestContext = new RequestContext <SpinArgs>("simulation", "Cleopatra", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, Game = new Game { Id = 109 } }; var requestBonusContext = new RequestContext <BonusArgs>("unittest", "Cleopatra", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; requestBonusContext.UserSession = userSession; requestBonusContext.UserGameKey = user; var bonus1 = module.CreateBonus(result1).Value; var entity1 = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus1.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus1), BonusType = bonus1.GetType().Name, Version = 3, IsOptional = bonus1.IsOptional, IsStarted = bonus1.IsStarted, RoundId = 1, BetReference = "" }; // action var freeSpinResult1 = module.ExecuteBonus(1, entity1, requestBonusContext).Value as FortuneChimesBonusSpinResult; // assert Assert.NotNull(freeSpinResult1); Assert.AreEqual(freeSpinResult1.GameResultType, GameResultType.FreeSpinResult); }
public void TestExecuteBonus() { // Arrange var user = new UserGameKey(-1, 3); var spinBet = new SpinBet(user, PlatformType.None) { Lines = 10, LineBet = 1.0m }; var result1 = new FortuneKoiSpinResult(user) { Wheel = new FortuneKoiWheel { Reels = new List <int[]> { new int[] { }, new int[] { 7, 7, 7 }, new int[] { }, new int[] { }, new int[] { } } }, BonusPositions = new List <BonusPosition> { new BonusPosition { Line = 1, Multiplier = 1, RowPositions = new List <int> { 0, 2, 0, 0, 0 } } }, Bonus = new Stake(Guid.NewGuid(), 2) { Count = 1 } }; result1.SpinBet = spinBet; var userSession = new UserSession { SessionKey = "unittest", UserId = -1 }; var requestContext = new RequestContext <SpinArgs>("simulation", "FortuneKoi", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, Game = new Game { Id = 32 } }; var requestBonusContext = new RequestContext <BonusArgs>("unittest", "FortuneKoi", PlatformType.None) { GameSetting = new GameSetting { GameSettingGroupId = 1 }, Query = new QueryCollection { }, }; requestBonusContext.UserSession = userSession; requestBonusContext.UserGameKey = user; var bonus1 = module.CreateBonus(result1).Value; var entity1 = new BonusEntity { UserId = userSession.UserId, GameId = requestContext.Game.Id, Guid = bonus1.Guid.ToString("N"), Data = Model.Utility.Extension.ToByteArray(bonus1), BonusType = bonus1.GetType().Name, Version = 3, IsOptional = bonus1.IsOptional, IsStarted = bonus1.IsStarted, RoundId = 1, BetReference = "" }; // action var reSpinResult = module.ExecuteBonus(1, entity1, requestBonusContext).Value as FortuneKoiReSpinResult; // Assert Assert.NotNull(reSpinResult); Assert.AreEqual(reSpinResult.SpinResult.HasBonus, ((FortuneKoiBonus)reSpinResult.Bonus).State is ReSpinState); Assert.AreEqual(reSpinResult.SpinResult.HasBonus, reSpinResult.SpinResult.Bonus != null); Assert.AreEqual(reSpinResult.SpinResult.HasBonus == false, ((FortuneKoiBonus)reSpinResult.Bonus).State is Finish); Assert.AreEqual(reSpinResult.GameResultType, GameResultType.RespinResult); }