コード例 #1
0
        public void CreateComment()
        {
            SlideComment dto = new SlideComment()
            {
                Text          = c_commentText,
                Author        = c_author,
                ChildComments = new List <SlideCommentBase>()
                {
                    new SlideComment()
                    {
                        Text   = c_childCommentText,
                        Author = c_author
                    }
                }
            };

            TestUtils.Upload(c_fileName, c_folderName + "/" + c_fileName);
            SlideComments response = TestUtils.SlidesApi.CreateComment(c_fileName, 3, dto, null, c_password, c_folderName);

            Assert.AreEqual(1, response.List.Count);
            Assert.AreEqual(c_commentText, response.List[0].Text);
            Assert.AreEqual(c_author, response.List[0].Author);
            Assert.AreEqual(c_childCommentText, response.List[0].ChildComments[0].Text);
            Assert.AreEqual(c_author, response.List[0].ChildComments[0].Author);
        }
コード例 #2
0
        /// <summary>
        ///     Add a comment to the specified slide
        /// </summary>
        /// <param name="slide">PPT.Slide object instance to add the comment to</param>
        /// <param name="comment">SlideComment object containing configuration for the slide comment</param>
        /// <returns></returns>
        public PPT.Slide AddComment(PPT.Slide slide, SlideComment comment)
        {
            PPT.Comment newComment = slide.Comments.Add(
                comment.LeftPosition,
                comment.TopPosition,
                comment.Author,
                comment.AuthorInitials,
                comment.Comment);

            return(slide);
        }
コード例 #3
0
        /// <summary>
        ///     Delete the specified comment from a slide
        /// </summary>
        /// <param name="slide">PPT.Slide object instance to delete the comment from</param>
        /// <param name="slideComment">The SlideComment object to delete</param>
        /// <returns></returns>
        public PPT.Slide DeleteComment(PPT.Slide slide, SlideComment slideComment)
        {
            foreach (PPT.Comment comment in slide.Comments)
            {
                if (comment.Text == slideComment.Comment && comment.Author == slideComment.Author &&
                    comment.AuthorInitials == slideComment.AuthorInitials)
                {
                    comment.Delete();
                }
            }

            return(slide);
        }
        protected override void Given()
        {
            this.slideManager       = new SlideManager();
            this.powerpointHandle   = new Microsoft.Office.Interop.PowerPoint.Application();
            this.presentationHandle = this.SUT.CreatePowerPointPresentation(this.powerpointHandle, false);
            this.slideHandle        = this.slideManager.AddSlideToEnd(this.presentationHandle);
            this.slideComment       = new SlideComment
            {
                Author         = "Test User",
                AuthorInitials = "TA",
                Comment        = "This is a test comment",
                LeftPosition   = 100f,
                TopPosition    = 100f
            };

            this.slideManager.AddComment(this.slideHandle, slideComment);

            this.initialCommentCount = this.slideManager.CountComments(this.slideHandle);
        }
コード例 #5
0
        public void CreateCommentOnline()
        {
            SlideComment dto = new SlideComment()
            {
                Text          = c_commentText,
                Author        = c_author,
                ChildComments = new List <SlideCommentBase>()
                {
                    new SlideComment()
                    {
                        Text   = c_childCommentText,
                        Author = c_author
                    }
                }
            };
            Stream document       = File.OpenRead(Path.Combine(TestUtils.TestDataPath, c_fileName));
            Stream outputDocument = TestUtils.SlidesApi.CreateCommentOnline(document, 3, dto, null, c_password);

            Assert.AreNotEqual(document.Length, outputDocument.Length);
        }