-
-
Save dcomartin/ea0fabbf9d199cda0ca81d51b022da08 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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