-
-
Save dcomartin/7a5f887e1f2bdf57236bdfd61b4fbd9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WarehouseProductTests | |
{ | |
private readonly string _sku; | |
private readonly int _initialQuantity; | |
private readonly WarehouseProduct _sut; | |
private readonly Fixture _fixture; | |
public WarehouseProductTests() | |
{ | |
_fixture = new Fixture(); | |
_fixture.Customizations.Add(new Int32SequenceGenerator()); | |
_sku = _fixture.Create<string>(); | |
_initialQuantity = (int)_fixture.Create<uint>(); | |
_sut = WarehouseProduct.Load(_sku, new [] { | |
new ProductReceived(_sku, _initialQuantity, DateTime.UtcNow) | |
}); | |
} | |
[Fact] | |
public void ShipProductShouldRaiseProductShipped() | |
{ | |
var quantityToShip = _fixture.Create<int>(); | |
_sut.ShipProduct(quantityToShip); | |
var outEvents = _sut.GetUncommittedEvents(); | |
outEvents.Count.ShouldBe(1); | |
var outEvent = outEvents.Single(); | |
outEvent.ShouldBeOfType<ProductShipped>(); | |
var productShipped = (ProductShipped)outEvent; | |
productShipped.ShouldSatisfyAllConditions( | |
x => x.Quantity.ShouldBe(quantityToShip), | |
x => x.Sku.ShouldBe(_sku), | |
x => x.EventType.ShouldBe("ProductShipped") | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment