public void GuessTest_Cows4() { CowsAndBulls game = new CowsAndBulls(); game.Guess("1234", "1234"); Assert.Equal(4, game.GuessedCows); }
public void ConstructorTest() { CowsAndBulls game = new CowsAndBulls(); Assert.Equal("Playing", game.Status); Assert.Equal(0, game.Guesses); }
public void GuessTest_Cows2Bulls2() { CowsAndBulls game = new CowsAndBulls(); game.Guess("1100", "1010"); Assert.Equal(2, game.GuessedCows); Assert.Equal(2, game.GuessedBulls); }
public void Test3() { var guesser = new CowsAndBulls(); Assert.Equal(4, guesser.CountCows(guesser.Goal)); Assert.Equal(3, guesser.CountCows(new string(String.Empty + guesser.Goal[0] + guesser.Goal[1] + guesser.Goal[2] + guesser.Goal[0]))); Assert.Equal(2, guesser.CountCows(new string(String.Empty + guesser.Goal[0] + guesser.Goal[1] + guesser.Goal[1] + guesser.Goal[0]))); Assert.Equal(1, guesser.CountCows(new string(String.Empty + guesser.Goal[0] + guesser.Goal[2] + guesser.Goal[1] + guesser.Goal[0]))); Assert.Equal(0, guesser.CountCows(new string(String.Empty + guesser.Goal[3] + guesser.Goal[2] + guesser.Goal[1] + guesser.Goal[0]))); }
public void Test2() { var guesser = new CowsAndBulls(); Assert.Equal(0, guesser.CountBulls("1234", "1234")); Assert.Equal(1, guesser.CountBulls("1234", "1231")); Assert.Equal(2, guesser.CountBulls("1234", "1241")); Assert.Equal(3, guesser.CountBulls("1234", "1341")); Assert.Equal(4, guesser.CountBulls("1234", "2341")); }
public void Test1() { var guesser = new CowsAndBulls(); for (int num = 0; num < 100000; num++) { if (num < 1000 || num > 9999) { Assert.Equal("bad input", guesser.Guess(num)); } else { Assert.NotEqual("bad input", guesser.Guess(num)); } } }
public void CheckUserInputTest_CorrectInput() { CowsAndBulls game = new CowsAndBulls(); Assert.True(game.CheckUserInput("1234")); }
public void CheckUserInputTest_FalseInput(string guess) { CowsAndBulls game = new CowsAndBulls(); Assert.False(game.CheckUserInput(guess)); }
public void RandomNumberTest_ContainsNumbers() { CowsAndBulls game = new CowsAndBulls(); Assert.True(Int32.Parse(game.RandomNumber()) >= 0 && Int32.Parse(game.RandomNumber()) <= 9999); }
public void RandomNumberTest_ProperLength() { CowsAndBulls game = new CowsAndBulls(); Assert.Equal(4, game.RandomNumber().Length); }