示例#1
0
        public void ShouldTransitionDirectly()
        {
            var state = new UpdatePointsState(gameManagerMock.Object, false);

            state.OnEntry();
            Assert.IsTrue(state.OnDuring() is GenerateMapState);
        }
示例#2
0
        public void LevelShouldDefaultToZero()
        {
            var state = new UpdatePointsState(gameManagerMock.Object, false);

            state.OnEntry();
            persistentStorageMock.Verify(foo => foo.GetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.Is <int>(i => i == 0)));
            // It defaults to 0, so when we call OnEntry, it becomes 1
            persistentStorageMock.Verify(foo => foo.SetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.Is <int>(i => i == 1)));
        }
示例#3
0
        public void ShouldStayOnLevel0IfPlayerDied()
        {
            persistentStorageMock.Setup(foo => foo.GetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.IsAny <int>())).Returns(0);

            var state = new UpdatePointsState(gameManagerMock.Object, true);

            state.OnEntry();
            persistentStorageMock.Verify(foo => foo.SetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.Is <int>(i => i == 0)));
        }
示例#4
0
        public void ShouldIncrementLevelByOneIfCompletedMap()
        {
            persistentStorageMock.Setup(foo => foo.GetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.IsAny <int>())).Returns(5);

            var state = new UpdatePointsState(gameManagerMock.Object, false);

            state.OnEntry();
            persistentStorageMock.Verify(foo => foo.SetInt(It.Is <string>((s) => s.Equals(Constants.currentLevelKey)), It.Is <int>(i => i == 6)));
        }