Example #1
0
        public void GetNextColor_ReturnsFirstColor_OnFirstCall()
        {
            FrequencyBasedColorAlternator alternator = GetDummyAlternator();
            Color firstColor = alternator.GetNextColor(dummyTarget);

            Assert.Equal(firstColor, dummyColors.First());
        }
Example #2
0
        public void GetNextColor_ReturnsThirdColor_OnThirdCall()
        {
            FrequencyBasedColorAlternator alternator = GetDummyAlternator();
            Color firstColor  = alternator.GetNextColor(dummyTarget);
            Color secondColor = alternator.GetNextColor(dummyTarget);
            Color thirdColor  = alternator.GetNextColor(dummyTarget);

            Assert.Equal(thirdColor, dummyColors.Last());
        }
Example #3
0
        public void GetNextColor_ThrowsException_WhenCalledWithNoColorsAssigned()
        {
            FrequencyBasedColorAlternator alternator = new FrequencyBasedColorAlternator(1);

            Assert.Throws <InvalidOperationException>(() => alternator.GetNextColor(dummyTarget));
        }
        public void GetNextColor_ThrowsException_WhenCalledWithNoColorsAssigned()
        {
            FrequencyBasedColorAlternator alternator = new FrequencyBasedColorAlternator(1);

            Assert.Throws<InvalidOperationException>(() => alternator.GetNextColor(dummyTarget));
        }