Beispiel #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"));
        }
Beispiel #2
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"));
        }
Beispiel #3
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"));
        }
Beispiel #4
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"));
        }
Beispiel #5
0
        public void RemoveComment()
        {
            CellAddress addrA1 = new CellAddress("A1");
            CellAddress addrA2 = new CellAddress("A2");
            CellAddress addrA3 = new CellAddress("A3");

            CommentsTable sheetComments = new CommentsTable();
            CT_Comment    a1            = sheetComments.NewComment(addrA1);
            CT_Comment    a2            = sheetComments.NewComment(addrA2);
            CT_Comment    a3            = sheetComments.NewComment(addrA3);

            Assert.AreSame(a1, sheetComments.GetCTComment(addrA1));
            Assert.AreSame(a2, sheetComments.GetCTComment(addrA2));
            Assert.AreSame(a3, sheetComments.GetCTComment(addrA3));
            Assert.AreEqual(3, sheetComments.GetNumberOfComments());

            Assert.IsTrue(sheetComments.RemoveComment(addrA1));
            Assert.AreEqual(2, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment(addrA1));
            Assert.AreSame(a2, sheetComments.GetCTComment(addrA2));
            Assert.AreSame(a3, sheetComments.GetCTComment(addrA3));

            Assert.IsTrue(sheetComments.RemoveComment(addrA2));
            Assert.AreEqual(1, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment(addrA1));
            Assert.IsNull(sheetComments.GetCTComment(addrA2));
            Assert.AreSame(a3, sheetComments.GetCTComment(addrA3));

            Assert.IsTrue(sheetComments.RemoveComment(addrA3));
            Assert.AreEqual(0, sheetComments.GetNumberOfComments());
            Assert.IsNull(sheetComments.GetCTComment(addrA1));
            Assert.IsNull(sheetComments.GetCTComment(addrA2));
            Assert.IsNull(sheetComments.GetCTComment(addrA3));
        }