Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created October 29, 2025 15:16
Show Gist options
  • Select an option

  • Save dcomartin/ea0fabbf9d199cda0ca81d51b022da08 to your computer and use it in GitHub Desktop.

Select an option

Save dcomartin/ea0fabbf9d199cda0ca81d51b022da08 to your computer and use it in GitHub Desktop.
public class ShipmentTests
{
[Fact]
public void Shipment_CanShip_ReturnsTrue_WhenAllRulesPass()
{
// Arrange
var shipment = new ShipmentBuilder()
.WithDestination("New York")
.WithStatus(ShipmentStatus.Pending)
.WithPackedPackages(3)
.Build();
var rules = new List<IShipmentReadinessRule>
{
new HasValidDestinationRule(),
new AllPackagesPackedRule(),
new NotAlreadyShippedRule()
};
// Act
var result = shipment.CanShip(rules);
// Assert
Assert.True(result);
}
[Fact]
public void Shipment_CanShip_ReturnsFalse_WhenAnyRuleFails()
{
// Arrange
var shipment = new ShipmentBuilder()
.WithDestination("") // Invalid
.WithStatus(ShipmentStatus.Pending)
.WithPackedPackages(3)
.Build();
var rules = new List<IShipmentReadinessRule>
{
new HasValidDestinationRule(),
new AllPackagesPackedRule(),
new NotAlreadyShippedRule()
};
// Act
var result = shipment.CanShip(rules);
// Assert
Assert.False(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment