Пример #1
0
        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);
        }
Пример #2
0
        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);
        }