Пример #1
0
            public void ExecutesACommandToEnd()
            {
                var service = Substitute.For<IWorkoutService>();
                var invoker = Substitute.For<ICommandInvoker>();
                var controller = new WorkoutController(service, invoker);

                controller.End();

                invoker.Received().ExecuteResult<EndWorkoutCommand, Guid>(Arg.Any<EndWorkoutCommand>());
            }
Пример #2
0
            public void RedirectsToASummaryPage()
            {
                var id = Guid.NewGuid();
                var service = Substitute.For<IWorkoutService>();
                var invoker = Substitute.For<ICommandInvoker>();
                invoker.ExecuteResult<EndWorkoutCommand, Guid>(Arg.Any<EndWorkoutCommand>()).Returns(id);
                var controller = new WorkoutController(service, invoker);

                RedirectToRouteResult result = (RedirectToRouteResult)controller.End();
                result.RouteValues["id"].ShouldEqual(id);
                result.RouteValues["action"].ShouldEqual("Index");
                result.RouteValues["controller"].ShouldEqual("Summary");
            }