public void BeforeAndAfterEventsAreExecuted() { // Given var subject = new ExecutionLifecycleCommand(); // When subject.Execute("do-stuff"); // Then subject.Before.ShouldNotBe(DateTime.MinValue); subject.Begin.ShouldBeGreaterThan(subject.Before); subject.After.ShouldBeGreaterThan(subject.Begin); }
public void BeforeAndAfterEventsAreExecutedOnSubCommand() { // Given var root = new RootCommand(); var subject = new ExecutionLifecycleCommand(); root.RegisterSubCommand(subject); // When root.Execute("execution-lifecycle", "do-stuff"); // Then subject.Before.ShouldNotBe(DateTime.MinValue); subject.Begin.ShouldBeGreaterThan(subject.Before); subject.After.ShouldBeGreaterThan(subject.Begin); }