Пример #1
0
        public void GetCellComment()
        {
            CommentsTable sheetComments = new CommentsTable();

            CT_Comments    comments    = sheetComments.GetCTComments();
            CT_CommentList commentList = comments.commentList;

            // Create 2 comments for A1 and A" cells
            CT_Comment comment0 = commentList.InsertNewComment(0);

            comment0.@ref = "A1";
            CT_Rst ctrst0 = new CT_Rst();

            ctrst0.t      = (TEST_A1_TEXT);
            comment0.text = (ctrst0);
            CT_Comment comment1 = commentList.InsertNewComment(0);

            comment1.@ref = ("A2");
            CT_Rst ctrst1 = new CT_Rst();

            ctrst1.t      = (TEST_A2_TEXT);
            comment1.text = (ctrst1);

            // Test Finding the right comment for a cell
            Assert.AreSame(comment0, sheetComments.GetCTComment("A1"));
            Assert.AreSame(comment1, sheetComments.GetCTComment("A2"));
            Assert.IsNull(sheetComments.GetCTComment("A3"));
        }
Пример #2
0
        public void RemoveComment()
        {
            CommentsTable sheetComments = new CommentsTable();
            CT_Comment    a1            = sheetComments.NewComment("A1");
            CT_Comment    a2            = sheetComments.NewComment("A2");
            CT_Comment    a3            = sheetComments.NewComment("A3");

            Assert.AreSame(a1, sheetComments.GetCTComment("A1"));
            Assert.AreSame(a2, sheetComments.GetCTComment("A2"));
            Assert.AreSame(a3, sheetComments.GetCTComment("A3"));
            Assert.AreEqual(3, sheetComments.GetNumberOfComments());

            Assert.IsTrue(sheetComments.RemoveComment("A1"));
            Assert.AreEqual(2, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment("A1"));
            Assert.AreSame(a2, sheetComments.GetCTComment("A2"));
            Assert.AreSame(a3, sheetComments.GetCTComment("A3"));

            Assert.IsTrue(sheetComments.RemoveComment("A2"));
            Assert.AreEqual(1, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment("A1"));
            Assert.IsNull(sheetComments.GetCTComment("A2"));
            Assert.AreSame(a3, sheetComments.GetCTComment("A3"));

            Assert.IsTrue(sheetComments.RemoveComment("A3"));
            Assert.AreEqual(0, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment("A1"));
            Assert.IsNull(sheetComments.GetCTComment("A2"));
            Assert.IsNull(sheetComments.GetCTComment("A3"));
        }
Пример #3
0
        public void FindAuthor()
        {
            CommentsTable sheetComments = new CommentsTable();

            Assert.AreEqual(1, sheetComments.GetNumberOfAuthors());
            Assert.AreEqual(0, sheetComments.FindAuthor(""));
            Assert.AreEqual("", sheetComments.GetAuthor(0));

            Assert.AreEqual(1, sheetComments.FindAuthor(TEST_AUTHOR));
            Assert.AreEqual(2, sheetComments.FindAuthor("another author"));
            Assert.AreEqual(1, sheetComments.FindAuthor(TEST_AUTHOR));
            Assert.AreEqual(3, sheetComments.FindAuthor("YAA"));
            Assert.AreEqual(2, sheetComments.FindAuthor("another author"));
        }