public void RedoRaiseEvent() { var target = new RedoUndoService <string>(3); target.Do("A"); target.Do("B"); target.Do("C"); target.Undo(); target.Undo(); var actualRedoDto = target.Redo(); var expectedUndoDto = "B"; Assert.AreEqual(expectedUndoDto, actualRedoDto); var actualDoList = target.DoList; var expectedDoList = new Stack <string>(new[] { "A", "B" }); Assert.AreEqual(expectedDoList, actualDoList); var actualRedoList = target.RedoList; var expectedRedoList = new Stack <string>(new[] { "C" }); Assert.AreEqual(expectedRedoList, actualRedoList); }
public void MaxStep2Do3Times_Then_DoList() { var target = new RedoUndoService <string>(2); target.Do("A"); target.Do("B"); target.Do("C"); var actual = target.DoList; var expected = new Stack <string>(new[] { "B", "C" }); actual.Should().BeEquivalentTo(expected); }
public void Do2TimesAndUndo2Times_Then_RedoList() { var target = new RedoUndoService <string>(3); target.Do("A"); target.Do("B"); target.Undo(); target.Undo(); var actual = target.RedoList; var expected = new Stack <string>(new[] { "B", "A" }); actual.Should().BeEquivalentTo(expected); }
public void Do3TimesAndUndo1TimesAndDo1Time_Then_RedoList() { var target = new RedoUndoService <string>(5); target.Do("A"); target.Do("B"); target.Do("C"); target.Undo(); target.Do("D"); var actual = target.RedoList; var expected = new Stack <string>(); actual.Should().BeEquivalentTo(expected); }
public void MaxStep2Do2TimesAndUndo3Times() { var target = new RedoUndoService <string>(2); target.Do("A"); target.Do("B"); target.Undo(); target.Undo(); target.Undo(); var actualDoList = target.DoList; var expectedDoList = new Stack <string>(); actualDoList.Should().BeEquivalentTo(expectedDoList); var actualRedoList = target.RedoList; var expectedRedoList = new Stack <string>(new[] { "B", "A" }); actualRedoList.Should().BeEquivalentTo(expectedRedoList); }