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")); }
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)); }