Exemplo n.º 1
0
        public void CreateOjRankTest()
        {
            HdojRank target = new HdojRank(); // TODO: 初始化为适当的值
            string web = @"<tr><td>2</td><td><img width='42px' height='27px' src='/images/country/1.gif'/></td><td><a href='userstatus.php?user=lmm333'>c-lou</a></td><td><a href='mailto:[email protected]'>[email protected]</a></td><td>njust</td><td>71</td><td>5128</td></tr>"; // TODO: 初始化为适当的值
            OjRankEntity expected = new OjRankEntity()
            {
                Ac = 71,
                //Submit = 711,
                UserName = "******",
                NickName = "c-lou",
                School = "njust",
                Email = "*****@*****.**",
                No = 2
            }; // TODO: 初始化为适当的值
            OjRankEntity actual;
            actual = target.CreateOjRank(web);

            Assert.AreEqual(expected.Ac, actual.Ac);
            Assert.AreEqual(expected.Email, actual.Email);
            Assert.AreEqual(expected.NickName, actual.NickName);
            Assert.AreEqual(expected.No, actual.No);
            Assert.AreEqual(expected.School, actual.School);
            Assert.AreEqual(expected.Submit, actual.Submit);
            Assert.AreEqual(expected.UserName, actual.UserName);
            //Assert.AreEqual(loumingming, actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }
Exemplo n.º 2
0
        public void GetRankListTest1()
        {
            HdojRank target = new HdojRank(); // TODO: 初始化为适当的值
            string web = target.GetSearchResult("lmm333"); // TODO: 初始化为适当的值
            Assert.IsNotNull(web);

            OjRankEntity lmm333 = new OjRankEntity()
            {
                Ac = 71,
                Submit = 0,
                UserName = "******",
                NickName = "c-lou",
                School = "njust",
                Email = "*****@*****.**",
                No = 5242
            }; // TODO: 初始化为适当的值

            List<OjRankEntity> actual;
            actual = target.GetRankList(web);

            Assert.IsTrue(actual.Count == 1);
            AssertOjRankEntity(actual[0], lmm333);
        }
Exemplo n.º 3
0
        public void GetLastACTest()
        {
            //http://acm.hdu.edu.cn/status.php?first=&pid=&user=lmm333&lang=0&status=0
            //4935688	2011-10-11 02:17:05	Accepted	4066	15MS	308K	20073B	G++	c-lou

            HdojRank target = new HdojRank(); // TODO: 初始化为适当的值
            string user_id = "lmm333"; // TODO: 初始化为适当的值
            DateTime expected = new DateTime(2011,10,11,2,17,5); // TODO: 初始化为适当的值
            DateTime actual;
            actual = target.GetLastAC(user_id);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void GetUserStatusTest()
        {
            HdojRank target = new HdojRank(); // TODO: 初始化为适当的值
            string user_id = "lmm333"; // TODO: 初始化为适当的值

            OjRankEntity actual;
            actual = target.GetUserStatus(user_id);

            OjRankEntity lmm333 = new OjRankEntity()
            {
                Ac = 71,
                Submit = 178,
                UserName = "******",
                NickName = "c-lou",
                School = "njust",
                Email = "*****@*****.**",
                No = 5242
            }; // TODO: 初始化为适当的值

            AssertOjRankEntity(actual, lmm333);
        }
Exemplo n.º 5
0
        public void GetRankListTest2()
        {
            HdojRank target = new HdojRank(); // TODO: 初始化为适当的值
            string web = target.GetSearchResult("njust"); // TODO: 初始化为适当的值
            Assert.IsNotNull(web);

            OjRankEntity lmm333 = new OjRankEntity()
            {
                Ac = 71,
                Submit = 0,
                UserName = "******",
                NickName = "c-lou",
                School = "njust",
                Email = "*****@*****.**",
                No = 5242
            }; // TODO: 初始化为适当的值

            OjRankEntity stsky = new OjRankEntity()
            {
                Ac = 49,
                Submit = 0,
                UserName = "******",
                NickName = "*[njust]STsky",
                School = "",
                Email = "*****@*****.**",
                No = 7879
            };

            List<OjRankEntity> actual;
            actual = target.GetRankList(web);

            Assert.IsTrue(actual.Count == 62);
            AssertOjRankEntity(actual[1], lmm333);
            AssertOjRankEntity(actual[3], stsky);

            //Assert.AreEqual(loumingming, actual);
        }