public void WhenShipIsFilledItIsInBalance() { //Arrange Ship ship = new Ship(6, 8); List <Container> containers = ContainerConstructor.CreateRandomContainers(1000); //Act containers.SortForShip(); ship.DistributeMaxAndReturn(containers); //Assert if (ship.PercentageLeft < 40 || ship.PercentageLeft > 60) { Assert.Fail(); } if (ship.PercentageRight < 40 || ship.PercentageRight > 60) { Assert.Fail(); } }
public void Every_Fourth_Stack_Is_Lower_Than_The_Stack_Before_Or_After_That_If_One_Of_Those_Has_A_Valuable_Container() { //Arrange ShipRow sr = new ShipRow(7); List <Container> containers = ContainerConstructor.CreateRandomContainers(500); containers.SortForShip(); //Act foreach (Container container in containers) { sr.AddContainer(container); } //Assert if (sr.Stacks[2].HasValuable && sr.Stacks[3].ContainerCount >= sr.Stacks[2].ContainerCount) { Assert.Fail(); } if (sr.Stacks[4].HasValuable && sr.Stacks[3].ContainerCount >= sr.Stacks[4].ContainerCount) { Assert.Fail(); } }