public void a_validation_error_should_be_returned() { using (var context = new TestStack(typeof(AddProduct))) { context.Send(new StockProductCommand("asdf", -1)); context.LastResult.ShouldContainMessage("The product quantity must be greater than 0."); } }
public void a_validation_error_should_be_returned() { using (var context = new TestStack(typeof(AddProduct))) { context.Send(new AddProductCommand("abcde", "")); context.LastResult.ShouldContainMessage("A product name must be unique."); } }
public void a_product_with_the_name_and_description_are_added() { using (var context = new TestStack(typeof(AddProduct))) { context.Send(new AddProductCommand("abcde", "")); context.Domain.Find <Product>().Result.Count().Should().Be(1); } }
public void ShouldBeSuccessful() { using (var stack = new TestStack(typeof(AddProduct))) { stack.Send(new AddProductCommand("asdf")); stack.LastResult.ShouldBeSuccessful(); } }
public void should_not_be_successful() { using (var stack = new TestStack(typeof(AddProduct))) { stack.Send(new AddProductCommand(null)); stack.LastResult.ShouldNotBeSuccessful(); } }
public void should_have_the_correct_message() { using (var stack = new TestStack(typeof(AddProduct))) { stack.Send(new AddProductCommand(null)); stack.LastResult.ShouldContainMessage("Name cannot be null."); } }
public void should_add_a_product() { using (var stack = new TestStack(typeof(AddProduct))) { stack.Send(new AddProductCommand("name")); stack.Domain.Find <Product>(e => e.Name == "name").Result.Count().Should().Be(1); } }
public void should_add_an_item_if_not_exists() { using (var context = new TestStack(typeof(AddProduct))) { context.Send(new StockProductCommand("asdf", 10)); var target = context.Domain.Find <StockItem>(e => e.ProductId == "asdf").Result.FirstOrDefault(); target.Should().NotBeNull(); } }
public void should_increment_the_quantity_of_existing_item() { using (var context = new TestStack(typeof(AddProduct))) { context.Send(new StockProductCommand(StockOne.ProductId, 10)); var target = context.Domain.Find <StockItem>(e => e.ProductId == StockOne.ProductId).Result.FirstOrDefault(); target.Quantity.Should().Be(15); } }