예제 #1
0
        public void ShouldReturnRandomColor(Int32 randomNumber, String expectedColor)
        {
            MockedRandom.Setup(x => x.Next(0x1000000))
            .Returns(randomNumber);

            String color = Sut.GetNextColor();

            Assert.Equal(expectedColor, color);
        }
예제 #2
0
    public void ShouldReturnCorrectColor(Int32 index, ChatColorPresets expectedColor)
    {
        MockedRandom.Setup(x => x
                           .Next(Enum.GetValues(typeof(ChatColorPresets)).Length))
        .Returns(index);

        String actualColor = Sut.GetNextColor();

        Assert.Equal(expectedColor.ToString(), actualColor);
    }
        public void ShouldNotAddNewInfestationAtBronze(Int32 mouseTrapCount)
        {
            MockedRandom.SetupReturnMaximum();
            MockedRandom.Setup(x => x.NextDouble()).Returns(0);
            Player.Rank           = Rank.Bronze;
            Player.MouseTrapCount = mouseTrapCount;

            var outputMessage = Sut.UpdateInfestationStatus(Player);

            Assert.NotNull(outputMessage);
            Assert.Empty(outputMessage);
            Assert.Equal(0, Player.RatCount);
            Assert.Equal(mouseTrapCount, Player.MouseTrapCount);
        }
        public void ShouldAddNewInfestationUncontested(Rank rank, Int32 initialRatCount)
        {
            MockedRandom.SetupReturnMaximum();
            MockedRandom.Setup(x => x.NextDouble()).Returns(0);
            Player.Rank     = rank;
            Player.RatCount = initialRatCount;
            var expectedRatCount = HazardManager.InfestationMaximums[rank] + initialRatCount;

            var outputMessage = Sut.UpdateInfestationStatus(Player);

            Assert.NotNull(outputMessage);
            Assert.NotEmpty(outputMessage);
            Assert.Equal(expectedRatCount, Player.RatCount);
            Assert.Equal(0, Player.MouseTrapCount);
        }
        public void ShouldAddNewInfestationEliminated(
            Rank rank,
            Int32 oldRatCount,
            Int32 initialMouseTrapCount,
            Int32 expectedNewMouseTrapcount)
        {
            MockedRandom.SetupReturnMaximum();
            MockedRandom.Setup(x => x.NextDouble()).Returns(0);
            Player.Rank           = rank;
            Player.RatCount       = oldRatCount;
            Player.MouseTrapCount = initialMouseTrapCount;

            var outputMessage = Sut.UpdateInfestationStatus(Player);

            Assert.NotNull(outputMessage);
            Assert.NotEmpty(outputMessage);
            Assert.Equal(0, Player.RatCount);
            Assert.Equal(expectedNewMouseTrapcount, Player.MouseTrapCount);
        }