/// <summary> /// Creates a service comment for testing. /// </summary> /// <param name="commentType">The type of the comment.</param> /// <returns>A comment with values.</returns> private static Comment CreateServiceComment(CommentType commentType) { Comment comment; if (commentType == CommentType.Ink) { string strokes = @"<?xml version=""1.0"" encoding=""utf-16"" ?> <StrokeCollection xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> <Stroke> <Stroke.DrawingAttributes> <DrawingAttributes Width=""200"" Height=""300"" Color=""#01020304"" OutlineColor=""#02020304""/> </Stroke.DrawingAttributes> <Stroke.StylusPoints> <StylusPointCollection> <StylusPoint X=""100"" Y=""40""/> </StylusPointCollection> </Stroke.StylusPoints> </Stroke> </StrokeCollection>"; comment = new InkComment { Strokes = strokes, Text = "InkComment" }; } else { comment = new Comment { Text = "Text" }; } comment.Id = CreateUri(); comment.Type = commentType.ToString(); comment.MarkIn = 5; comment.MarkOut = 7.6; comment.Creator = "Creator"; comment.Created = new DateTime(2009, 1, 1); return(comment); }
/// <summary> /// Asserts that the <paramref name="serviceComment"/> contains equivalent values from the <paramref name="comment"/>. /// </summary> /// <param name="comment">The comment with expected values.</param> /// <param name="serviceComment">The comment with actual values.</param> private static void AssertComment(RCE.Infrastructure.Models.Comment comment, Comment serviceComment) { Assert.AreEqual(comment.ProviderUri, serviceComment.Id); Assert.AreEqual(comment.Creator, serviceComment.Creator); Assert.AreEqual(comment.Created, serviceComment.Created); Assert.AreEqual(comment.MarkIn, serviceComment.MarkIn); Assert.AreEqual(comment.MarkOut, serviceComment.MarkOut); Assert.AreEqual(comment.CommentType.ToString(), serviceComment.Type); Assert.AreEqual(comment.Text, serviceComment.Text); InkComment inkComment = serviceComment as InkComment; if (inkComment != null) { StringAssert.Contains(inkComment.Strokes, "#00000000"); StringAssert.Contains(inkComment.Strokes, "#01020304"); } }