示例#1
0
        public void UndoInsertion()
        {
            var textBuffer = new TextBuffer("", MockFor<IContentType>().Object);

            var undoServiceFactory = new UndoServiceFactory();
            var undoService = undoServiceFactory.ForTextBuffer(textBuffer);

            var oldSnapshot = textBuffer.CurrentSnapshot;
            textBuffer.Insert(0, "text");

            var changes = new List<TextChangeArgs>();
            textBuffer.Changed += (sender, args) => changes.Add(args);
            undoService.Undo();
            Assert.AreEqual(1, changes.Count);

            Assert.AreSame(oldSnapshot, textBuffer.CurrentSnapshot);
        }