Пример #1
0
        //Using the timer to change the state of the bath need and calling to update the bath ui
        private void UpdateTimedData(object sender, ElapsedEventArgs e)
        {
            TimeSpan timeElapsed = e.SignalTime - timeKeeper.StartTime;


            BathState newBathState = yoshi.CurrentBathState;

            if (yoshi.YoshiName != NameButton.Text)
            {
                NameButton.Text = yoshi.YoshiName.ToString();
            }

            if (timeElapsed.TotalSeconds < 10)
            {
                newBathState = BathState.good;
            }
            else if (timeElapsed.TotalSeconds < 20)
            {
                newBathState = BathState.normal;
            }
            else if (timeElapsed.TotalSeconds >= 20)
            {
                newBathState = BathState.bad;
            }
            if (newBathState != yoshi.CurrentBathState)
            {
                yoshi.CurrentBathState = newBathState;
                updateUI();
            }
        }
Пример #2
0
        public void BathTestMethod2()
        {
            var       BathStates2     = new BathStates();
            BathState bathState2      = BathState.bad;
            var       expectedResult2 = "bad";

            BathState result2 = BathStates.GetBathState(expectedResult2);

            Assert.AreEqual(bathState2, result2);
        }
Пример #3
0
        public void BathTestMethod3()
        {
            var       BathStates3     = new BathStates();
            BathState bathState3      = BathState.normal;
            var       expectedResult3 = "normal";

            BathState result3 = BathStates.GetBathState(expectedResult3);

            Assert.AreEqual(bathState3, result3);
        }
Пример #4
0
        public void BathTestMethod()
        {
            var       BathStates     = new BathStates();
            BathState bathState      = BathState.good;
            var       expectedResult = "good";

            BathState result = BathStates.GetBathState(expectedResult);

            Assert.AreEqual(bathState, result);
        }
Пример #5
0
        public static string GetBathString(BathState bathState)
        {
            switch (bathState)
            {
            case BathState.good:
                return("good");

            case BathState.normal:
                return("normal");

            case BathState.bad:
                return("bad");

            default:
                return("dead");
            }
        }