public void AddInvalidNumberOfPontsTest() { ScoreSystemInfo scoreSystem = new ScoreSystemInfo("System 1", 0); ScoreMssqlContext sqlContext = new ScoreMssqlContext(); sqlContext.AddOrUpdateScore(1, -1, scoreSystem); }
public void AddInvalidPlaceTest() { ScoreSystemInfo scoreSystem = new ScoreSystemInfo("System 1", 0); ScoreMssqlContext sqlContext = new ScoreMssqlContext(); sqlContext.AddOrUpdateScore(-1, 1, scoreSystem); }
public void UpdateScoreTest() { ScoreSystemInfo scoreSystem = new ScoreSystemInfo("System 1", 0); ScoreSystemMssqlContext scoreSystemContext = new ScoreSystemMssqlContext(); ScoreMssqlContext scoreContext = new ScoreMssqlContext(); try { Assert.AreEqual(0, scoreSystemContext.GetScoreSystems().Count, "Cleanup of database failed"); scoreSystemContext.AddScoreSystem(scoreSystem.Name, scoreSystem.PointsForFastestLap); scoreContext.AddOrUpdateScore(1, 10, scoreSystem); Assert.AreEqual(1, scoreContext.GetScoresForScoreSystem(scoreSystem).Count); Assert.AreEqual(10, scoreContext.GetScoresForScoreSystem(scoreSystem)[0].Points); scoreContext.AddOrUpdateScore(1, 5, scoreSystem); Assert.AreEqual(1, scoreContext.GetScoresForScoreSystem(scoreSystem).Count); Assert.AreEqual(5, scoreContext.GetScoresForScoreSystem(scoreSystem)[0].Points); } finally { scoreContext.RemoveScore(1, scoreSystem); Assert.AreEqual(0, scoreContext.GetScoresForScoreSystem(scoreSystem).Count); scoreSystemContext.RemoveScoreSystem("System 1"); Assert.AreEqual(0, scoreSystemContext.GetScoreSystems().Count, "Cleanup of database failed"); } }