コード例 #1
0
        public void RankingUpdatePostTest()
        {
            try
            {
                var rankingController = new RankingController();

                var ranking = rankingController.GetRankingInfo("A000003", 101);

                Assert.AreEqual("A000003", ranking.StudentId);
                Assert.AreEqual(101, ranking.ScheduleId);
                Assert.AreEqual(1, ranking.Rank);

                rankingController.UpdateRanking(new Ranking
                {
                    StudentId  = "A000003",
                    ScheduleId = 101,
                    Rank       = 50
                });

                ranking = rankingController.GetRankingInfo("A000003", 101);

                Assert.AreEqual("A000003", ranking.StudentId);
                Assert.AreEqual(101, ranking.ScheduleId);
                Assert.AreEqual(50, ranking.Rank);

                rankingController.UpdateRanking(new Ranking
                {
                    StudentId  = "A000003",
                    ScheduleId = 101,
                    Rank       = 1
                });

                ranking = rankingController.GetRankingInfo("A000003", 101);

                Assert.AreEqual("A000003", ranking.StudentId);
                Assert.AreEqual(101, ranking.ScheduleId);
                Assert.AreEqual(1, ranking.Rank);
            }
            catch
            {
                throw;
            }
        }