public void Should_be_able_Send_the_Command_to_the_Bus() { AddProductCommand command = new AddProductCommand { Name = "Reebok Shoe", Categories = "Shoes", Id = 1 }; InMemoryCommandBus Bus = new InMemoryCommandBus(); InventoryController controller = new InventoryController(Bus); ConfigureController(controller); HttpResponseMessage Message = controller.Post(command); Message.StatusCode.Should().Be(HttpStatusCode.Created); Message.Headers.Location.ToString().Should().Be("http://localhost/api/Product/1"); Bus.Command.Should().Be(command); }
public void Should_be_Able_to_Add_the_Product() { var baseAddress = new Uri("http://localhost:8082/"); var httpSelfhostConfiguration = new HttpSelfHostConfiguration(baseAddress); new MusicStoreBootStrap(httpSelfhostConfiguration).ConfigureDatabaseForTest(); AddProductCommand command = new AddProductCommand { Name = "Reebok Shoe", Categories = "Shoes", Id = 1 }; ICommandHandler<AddProductCommand> productCommand = new AddProductCommandHandler(); productCommand.Execute(command); ProductViewModel ViewModel = Database.Open().Products.FindById(1); ViewModel.Name.Should().Be(command.Name); }