Beispiel #1
0
        public void GetRandomSeed([Values(-599628938, -1717973115, 1534786375)] int expected, [Values(1, 2, 3)] int count)
        {
            var avatarState = new AvatarState(
                _avatarAddress,
                new Address(),
                0,
                _tableSheets.GetAvatarSheets(),
                new GameConfigState(),
                new Address()
                );

            Assert.AreEqual(0, avatarState.Nonce);
            var seed = 0;

            for (var i = 0; i < count; i++)
            {
                seed = avatarState.GetRandomSeed();
                Assert.AreEqual(i + 1, avatarState.Nonce);
            }
            Assert.AreEqual(expected, seed);
            var random1 = new System.Random(seed);
            var random2 = new System.Random(seed);

            Assert.AreEqual(random1.Next(100), random2.Next(100));
            Assert.AreEqual(count, avatarState.Nonce);
        }