public void Setup()
        {
            _commandBus = MockRepository.GenerateStub<ICommandBus>();
            _mongoQueryProvider = MockRepository.GenerateStub<IMongoQueryProvider>();

            _createProductModel = new CreateProductModel { Name = TestName, Category = TestCategory };

            _exampleController = new ExampleController(_commandBus, _mongoQueryProvider);
        }
Exemplo n.º 2
0
        public ActionResult CreateProduct(CreateProductModel createProductModel)
        {
            var productId = Guid.NewGuid();

            var result = _commandBus.Send<ICreateProductMessage>(this, message =>
                {
                    message.ProductId = productId;
                    message.Name = createProductModel.Name;
                    message.Category = createProductModel.Category;
                });

            return result ? RedirectToAction("Details", new {id = productId})
                : (ActionResult) View();
        }