//public void OnPost() //{ //} public IActionResult OnPostNext() { Score = HttpContext.Session.GetInt32(SCORE) ?? 0; Index = HttpContext.Session.GetInt32(INDEX) ?? 0; Index = 1 + Index; Score = Score + 10; game = new SpeakingGame(Index, Score); if (game.CurrentWord(Index) != "Game Over") { Meanning = game.CurrentExplain(Index); TunWord = game.CurrentWord(game.Index); } if (Score >= 100) { Meanning = "end of the Game"; TunWord = "el loaabaa wfet"; Score = 100; } HttpContext.Session.SetInt32(INDEX, game.Index); HttpContext.Session.SetInt32(SCORE, game.Score); return(Page()); }
public void TestConstec() { game = new SpeakingGame(4, 40); Assert.Equal(4, game.Index); Assert.Equal(40, game.Score); Assert.Equal("do you speek english ?", game.CurrentExplain(game.Index)); }
public void OnGet() { game = new SpeakingGame(); TunWord = game.Word; Meanning = game.Trans; HttpContext.Session.Clear(); }
public void TestEnd() { game = new SpeakingGame(0, 0); Assert.Equal(false, game.End); int max = game.Size; game.Index = game.Size; Assert.Equal(game.Index, max); string last = game.CurrentWord(max); Assert.Equal("Game Over", last); Assert.True(game.CheckEnd()); }
// initialisation before every test public GameTests() { game = new SpeakingGame(); }