Skip to content

Commit

Permalink
test: remove no longer applicable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
abdes committed Oct 14, 2024
1 parent 5759865 commit edbd20a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 115 deletions.
53 changes: 0 additions & 53 deletions projects/TimeMachine/tests/HistoryKeeperTests.Changes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,57 +143,4 @@ public void CanRedo_Should_Be_False_When_RedoStack_Is_Empty()
// Assert
canRedo.Should().BeFalse();
}

[TestMethod]
public void AddChange_Should_Raise_UndoStackChanged_When_Not_Undoing()
{
// Arrange
var changeMock = new Mock<IChange>();
var historyKeeper = UndoRedo.Default[changeMock];
historyKeeper.State = HistoryKeeper.States.Idle;

using var monitoredHistoryKeeper = historyKeeper.Monitor();

// Act
historyKeeper.AddChange(changeMock.Object);

// Assert
monitoredHistoryKeeper.Should().Raise(nameof(HistoryKeeper.UndoStackChanged));
}

[TestMethod]
public void AddChange_Should_Raise_RedoStackChanged_When_Undoing()
{
// Arrange
var changeMock = new Mock<IChange>();
var historyKeeper = UndoRedo.Default[changeMock];
historyKeeper.State = HistoryKeeper.States.Undoing;

using var monitoredHistoryKeeper = historyKeeper.Monitor();

// Act
historyKeeper.AddChange(changeMock.Object);

// Assert
monitoredHistoryKeeper.Should().Raise(nameof(HistoryKeeper.RedoStackChanged));
}

[TestMethod]
public void Clear_Should_Raise_UndoStackChanged_And_RedoStackChanged()
{
// Arrange
var changeMock = new Mock<IChange>();
var historyKeeper = UndoRedo.Default[changeMock];
historyKeeper.State = HistoryKeeper.States.Idle;
historyKeeper.AddChange(changeMock.Object);

using var monitoredHistoryKeeper = historyKeeper.Monitor();

// Act
historyKeeper.Clear();

// Assert
monitoredHistoryKeeper.Should().Raise(nameof(HistoryKeeper.UndoStackChanged));
monitoredHistoryKeeper.Should().Raise(nameof(HistoryKeeper.RedoStackChanged));
}
}
62 changes: 0 additions & 62 deletions projects/TimeMachine/tests/HistoryKeeperTests.Undo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,6 @@ public void Undo_ShouldNotMoveChangeToRedoStack_WhenApplyThrowsException()
historyKeeper.RedoStack.Should().BeEmpty();
}

[TestMethod]
[TestCategory("HistoryKeeper.Undo")]
public void Undo_ShouldRaiseEvents_WhenUndoIsPerformed()
{
// Arrange
var historyKeeper = UndoRedo.Default[new object()];
using var monitoredSubject = historyKeeper.Monitor();

// Act
Action();
historyKeeper.Undo();

// Assert
monitoredSubject.Should().Raise("UndoStackChanged");
monitoredSubject.Should().Raise("RedoStackChanged");

void ReverseAction()
{
_ = 0;
historyKeeper.AddChange("redo = set", Action);
}

void Action()
{
_ = 1;
historyKeeper.AddChange("undo = reset", ReverseAction);
}
}

[TestMethod]
public void Redo_ShouldCommitTransactions_WhenTransactionsExist()
{
Expand Down Expand Up @@ -222,37 +193,4 @@ public void Redo_ShouldNotThrow_WhenRedoStackIsEmpty()
// Assert
act.Should().NotThrow();
}

[TestMethod]
public void Redo_ShouldRaiseEvents_WhenRedoIsPerformed()
{
// Arrange
var historyKeeper = UndoRedo.Default[new object()];

Action();

historyKeeper.Undo();
historyKeeper.CanRedo.Should().BeTrue();

using var monitoredSubject = historyKeeper.Monitor();

// Act
historyKeeper.Redo();

// Assert
monitoredSubject.Should().Raise("RedoStackChanged");
monitoredSubject.Should().Raise("UndoStackChanged");

void ReverseAction()
{
_ = 0;
historyKeeper.AddChange("redo = set", Action);
}

void Action()
{
_ = 1;
historyKeeper.AddChange("undo = reset", ReverseAction);
}
}
}

0 comments on commit edbd20a

Please sign in to comment.