Beispiel #1
0
        public void Should_Support_Undo()
        {
            var sut = new ReversibleDocument <TextDocument>(new TextDocument());

            sut.AddChar('a');
            sut.AddChar('z');
            sut.AddChar('E');
            sut.AddChar('f');
            sut.AddChar('é');

            sut.Undo();

            Assert.That(sut.Document.ToString(), Is.EqualTo("azEf"));
        }
Beispiel #2
0
 public static void AddChar(this ReversibleDocument <TextDocument> doc, char c)
 {
     doc.Do(new AddCharCommand(c)).Apply();
 }
 /// <summary>
 /// Inverts all pixels in the picture.
 /// </summary>
 /// <param name="doc">The document to apply this transformation to.</param>
 /// <returns></returns>
 public static ReversibleDocument <IPicture> Invert(this ReversibleDocument <IPicture> doc)
 {
     return(doc.Do(new InvertPictureReversibleCommand()));
 }
 public static ReversibleDocument <IPicture> Fill(this ReversibleDocument <IPicture> doc, int x, int y, Color oldColor, Color newColor)
 {
     return(doc.Do(new FillPictureWithColorCommand(oldColor, newColor, x, y)));
 }
 /// <summary>
 /// Rotates the picture by angleDegrees degrees.
 /// </summary>
 /// <param name="doc">The document to apply this transformation to.</param>
 /// <param name="angleDegrees">The amount to rotate, in degrees.</param>
 /// <returns></returns>
 public static ReversibleDocument <IPicture> Rotate(this ReversibleDocument <IPicture> doc, double angleDegrees)
 {
     return(doc.Do(new RotatePictureReversibleCommand(angleDegrees)));
 }