Пример #1
0
        public void TestFreeSpinFeatgure()
        {
            // arrange
            var freeSpin = new FreeSpin(1, 0);
            var user     = new UserGameKey(-1, 30);
            var bet      = new SpinBet(user, PlatformType.None)
            {
                Lines      = 30,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var action = new FreeSpinAction(1, PlatformType.None, bet, () =>
            {
                return(new List <IReadOnlyList <int> >
                {
                    new int[] { 1, 1, 1 },
                    new int[] { 2, 2, 2, 2 },
                    new int[] { 3, 3, 3, 3 },
                    new int[] { 4, 4, 4, 4 },
                    new int[] { 5, 5, 5 }
                });
            });

            // action
            var bikiniBeachState = FreeSpinReducer.Dispatch(freeSpin, action);
            var result           = bikiniBeachState.Result;

            // Assert
            Assert.IsTrue(bikiniBeachState.State is Finish);
            Assert.AreEqual(result.Wheel[0], new[] { 1, 1, 1 });
            Assert.AreEqual(result.Wheel[1], new[] { 10, 10, 10 });
            Assert.AreEqual(result.Wheel[2], new[] { 3, 3, 3 });
            Assert.AreEqual(result.Wheel[3], new[] { 4, 4, 4 });
            Assert.AreEqual(result.Wheel[4], new[] { 5, 5, 5 });
        }
Пример #2
0
        public void TestFreeSpinFeature()
        {
            // arrange
            var wheel = new DragonRichesWheel
            {
                Reels          = new List <int[]>(),
                CoinCollapsing = new DragonRichesWheel.CoinCollapse()
            };
            var holdSpinItem = new FreeSpin(new State(6, 0), 0);
            var user         = new UserGameKey(-1, 104);
            var bet          = new SpinBet(user, PlatformType.None)
            {
                Lines      = 30,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var action = new FreeSpinAction(1, PlatformType.None, bet, () => new List <IReadOnlyList <int> >
            {
                new List <int> {
                    1, 1, 1
                },
                new List <int> {
                    2, 2, 2
                },
                new List <int> {
                    3, 3, 3
                },
                new List <int> {
                    4, 4, 4
                },
                new List <int> {
                    5, 5, 5,
                }
            });

            // action
            var dragonState = FreeSpinReducer.Dispatch(holdSpinItem, action);

            // Assert
            if (dragonState.State is FreeSpin)
            {
                var freeSpinState = dragonState.State as FreeSpin;
                var scatters      = dragonState.Result.Wheel.Reels.Sum(ele => ele.Count(item => item == 9));
                Assert.AreEqual(freeSpinState.State.Count >= 5, true);
                Assert.AreEqual(false, freeSpinState.IsCompleted);
                Assert.AreEqual(scatters >= 3, freeSpinState.State.Count >= 12);
            }
            if (dragonState.State is HoldFreeSpin)
            {
                var holdFreeSpinState = dragonState.State as HoldFreeSpin;
                Assert.AreEqual(3, holdFreeSpinState.HoldSpin.State.Count == 3);
                Assert.AreEqual(3, holdFreeSpinState.FreeSpin.State.Count == 5);
                Assert.AreEqual(true, dragonState.Result.Wheel.Reels.Sum(ele => ele.Count(item => item == 12)) >= 6);
                Assert.AreEqual(false, holdFreeSpinState.IsCompleted);
            }
        }
Пример #3
0
        public void TestReSpinWithWildExpendAllReelFeatgure()
        {
            // arrange
            var freeSpin = new FreeSpin(new[] { 0, 1, 2, 3, 0 });
            var user     = new UserGameKey(-1, 30);
            var bet      = new SpinBet(user, PlatformType.None)
            {
                Lines      = 20,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var action = new FreeSpinAction(1, PlatformType.None, bet);

            // action
            var sevenWondersState = FreeSpinReducer.Dispatch(freeSpin, action);

            // Assert
            Assert.AreEqual(sevenWondersState.State is Finish, true);
        }
Пример #4
0
        public void TestReSpinWithWildExpendAtSecondReelFeatgure()
        {
            // arrange
            var freeSpin = new FreeSpin(new[] { 0, 1, 0, 0, 0 });
            var user     = new UserGameKey(-1, 30);
            var bet      = new SpinBet(user, PlatformType.None)
            {
                Lines      = 20,
                LineBet    = 1.0m,
                Multiplier = 1
            };
            var action = new FreeSpinAction(1, PlatformType.None, bet);

            // action
            var sevenWondersState = FreeSpinReducer.Dispatch(freeSpin, action);
            var result            = sevenWondersState.Result;
            var wheel             = result.Wheel.Reels;

            // Assert
            Assert.AreEqual(sevenWondersState.State is Finish, wheel[2].All(ele => ele != 7) && wheel[3].All(ele => ele != 7));
            Assert.AreEqual(sevenWondersState.State is FreeSpin, wheel[2].Any(ele => ele == 7) || wheel[3].Any(ele => ele == 7));
        }