Пример #1
0
        public void ShouldFailToExecuteOverridingModelWithNewInstance()
        {
            var request   = new Request("Test");
            var commander = new Commander <Request, Model>(request);

            Action action = () => commander.Execute(BasicCommand.Instance(Repo.Instance()), CommandOverridesModel.Instance());

            action.Should().Throw <ApplicationException>().WithMessage("Model cannot be replaced with another instance.");
        }
Пример #2
0
        public void ShouldExecuteBasicCommand()
        {
            var request   = new Request("Test");
            var commander = new Commander <Request, Model>(request);

            var model = commander.Execute(BasicCommand.Instance(Repo.Instance()));

            model.Name.Should().Be("Test");
            model.CreatedAt.Should().Be(DateTime.Today);
        }