コード例 #1
0
        public void ValueTest()
        {
            Guess guess = new Guess(0, "test");
            int testval = 99;

            guess.Value = testval;
            Assert.AreEqual(testval, guess.Value);
        }
コード例 #2
0
        public void PlayerNameTest()
        {
            Guess guess = new Guess(0, "test");
            string testname = "Some Testuser";

            guess.PlayerName = testname;
            Assert.AreEqual(testname, guess.PlayerName);
        }
コード例 #3
0
 public void GuessConstructorTest()
 {
     int value = 4;
     string playerName = "Testuser";
     Guess guess = new Guess(value, playerName);
     Assert.AreEqual(value, guess.Value);
     Assert.AreEqual(playerName, guess.PlayerName);
 }
コード例 #4
0
        public void PlayerAndGuessTest()
        {
            Guess guess = new Guess(33, "test");
            int testval = 99;
            string testname = "Random String";

            guess.Value = testval;
            guess.PlayerName = testname;
            Assert.AreEqual("Random String: 99", guess.PlayerAndGuess);
        }
コード例 #5
0
        public void PlayerAndGuessSetTest()
        {
            Guess guess = new Guess(33, "test");
            int testval = 99;
            string testname = "Random String";

            try
            {
                guess.PlayerAndGuess = testname + ": " + testval;
                Assert.Fail("Setting PlayerAndGuess should throw an NotImplementedException");
            }
            catch (NotImplementedException)
            {
                Assert.AreEqual("test: 33", guess.PlayerAndGuess);
            }
            catch (Exception e)
            {
                Assert.Fail("Setting PlayerAndGuess should throw an NotImplementedException, but got " + e.GetType().ToString());
            }
        }