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

                rankingController.DeleteRanking("A000009", 109);

                var ranking = rankingController.GetRankingInfo("A000009", 109);
                Assert.AreEqual(null, ranking);

                rankingController.InsertRanking(new Ranking
                {
                    StudentId  = "A000009",
                    ScheduleId = 109,
                    Rank       = 20
                });

                ranking = rankingController.GetRankingInfo("A000009", 109);
                Assert.AreEqual("A000009", ranking.StudentId);
                Assert.AreEqual(109, ranking.ScheduleId);
                Assert.AreEqual(20, ranking.Rank);

                rankingController.DeleteRanking("A000009", 109);

                ranking = rankingController.GetRankingInfo("A000009", 109);
                Assert.AreEqual(null, ranking);
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
        public void RankingGetTest()
        {
            var rankingController = new RankingController();
            var ranking           = rankingController.GetRankingInfo("A000003", 100);

            Assert.AreEqual("A000003", ranking.StudentId);
            Assert.AreEqual(100, ranking.ScheduleId);
            Assert.AreEqual(2, ranking.Rank);
        }
コード例 #3
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;
            }
        }