public void Content_Should_Be_Added() { var productId = Random <Guid>(); var title = Random <string>(); var description = Random <string>(); var attributeId = Random <int>(); var attributeValueId = Random <int>(); var @event = new ContentAddedToProduct( productId, title, description, new AttributeRef(attributeId, attributeValueId)); ScenarioForExisting() .Given( () => Product.Create(productId, Random <int>(), Random <int>(), Random <string>())) .When( product => product.AddContent(title, description, new AttributeRef(attributeId, attributeValueId)) ) .Then(@event) .AlsoAssert( product => product.Contents .Any(x => x.Title == title) ); }
private void Apply(ContentAddedToProduct @event) => _contents.Add(new Content(@event.Title, @event.Description, @event.SlicerAttribute));