Example #1
0
        public void AddWikiContentTest()
        {
            var ws = TestHelper.GetTestObj<WikiService>();

            long id = IDProvider.GetNewId("InsertWikiTest");

            KEYID ki = new KEYID(KEY, id);

            var res = ws.InsertWiki("test", "init content", ki);

            Assert.IsTrue(res.IsSuccess);

            var wiki = ws.GetWiki(ki);

            Assert.AreEqual(wiki.CrUserName, "test");
            Assert.AreEqual(wiki.WikiContent.Content, "init content");
            Assert.AreEqual(wiki.WikiContent.CrUserName, "test");

            res = ws.AddWikiContent("lanslot", "second content", ki, true);
            res = ws.AddWikiContent("lynn", "third content", ki,false);

            Assert.IsTrue(res.IsSuccess);

            var wiki2 = ws.GetWiki(ki);
            Assert.AreEqual(wiki2.CrUserName, "test");
            Assert.AreEqual(wiki2.WikiContent.Content, "third content");
            Assert.AreEqual(wiki2.WikiContent.CrUserName, "lynn");
            Assert.AreEqual(wiki2.WikiContent.Reversion, "1.1");
        }
Example #2
0
        public void KEYIDImplicitOperatorTest()
        {
            KEYID ki = new KEYID("k", 1);

            string kiStr = "k_1";

            Assert.AreEqual(ki.ToString(), kiStr);

            KEYID ki2 = kiStr;

            Assert.IsTrue(ki.ToString() == ki2.ToString());
            Assert.IsTrue(ki == ki2);
            Assert.IsTrue(ki == kiStr);
        }
Example #3
0
        public void InsertWikiTest()
        {
            var ws = TestHelper.GetTestObj<WikiService>();

            long id = IDProvider.GetNewId("InsertWikiTest");

            KEYID ki = new KEYID(KEY, id);

            var res = ws.InsertWiki("test", "init content", ki);

            Assert.IsTrue(res.IsSuccess);

            var wiki = ws.GetWiki(ki);

            Assert.AreEqual(wiki.CrUserName, "test");
            Assert.AreEqual(wiki.WikiContent.Content, "init content");
        }
Example #4
0
        public void MultipleRateTest()
        {
            var rs = TestHelper.GetTestObj<RateService>();
            rs.CanMultipleRate = true;

            int id =1;
            KEYID ki = new KEYID(KEY, id);
            while(rs.GetScore(ki).Times >0)
            {
                id++;
                ki = new KEYID(KEY, id);
            }

            rs.Rate(TestHelper.UserName, ki, 1);
            var res = rs.Rate(TestHelper.UserName, ki, 3);

            Assert.IsTrue(res.IsSuccess);

            var score = rs.GetScore(ki);

            Assert.AreEqual(score.Times, 2);
            Assert.AreEqual(score.Sum, 4);
            Assert.AreEqual(score.Average, 2);
        }