public void Add_2ValuableContainers_MoreThan30tons_Error() { //arrange ContainerCollection containerCollection = new ContainerCollection(2, 2); //assumption is to add two cooled containers Container container = new Container { Weight = 31, IsValuable = true }; Container container1 = new Container { Weight = 32, IsValuable = true }; //act containerCollection.AddCv(container); containerCollection.AddCv(container1); //assert Assert.AreEqual(0, containerCollection.GetCc().Count); }
public void Fill_FirstRow_CooledContainersAndValuableContainers_Succes() // Check to always stack valuable on top for first row { //arrange Ship ship = new Ship(2, 2, 20); ContainerCollection containerCollection = new ContainerCollection(2, 2); Container cc = new Container { Weight = 10, IsRefrigerated = true }; Container cc1 = new Container { Weight = 10, IsRefrigerated = true }; Container cv = new Container { Weight = 10, IsValuable = true }; Container cv2 = new Container { Weight = 10, IsValuable = true }; containerCollection.AddCc(cc); containerCollection.AddCc(cc1); containerCollection.AddCv(cv); containerCollection.AddCv(cv2); List <Container> cLastRow = new List <Container>(); cLastRow = ship.ListForFirstRow(containerCollection.GetCc(), containerCollection.GetCv()); bool bCool = true; //Last Row contains cooled containers Stack stack = new Stack(); //act ship.AddFirstLastRow(cLastRow, bCool); //assert foreach (Row row in ship.GetRows()) { row.GetStacks(); Assert.IsTrue(row.GetStacks().Last().BValuable); Assert.IsFalse(row.GetStacks().First().BValuable); } }
public void Fill_LastRow_NormalContainersAndValuableContainers_Succes() // Check to always stack valuable on top for last row { //arrange Ship ship = new Ship(2, 2, 20); ContainerCollection containerCollection = new ContainerCollection(2, 2); Container cn = new Container { Weight = 10 }; Container cn1 = new Container { Weight = 10 }; Container cv = new Container { Weight = 10, IsValuable = true }; Container cv2 = new Container { Weight = 10, IsValuable = true }; containerCollection.AddCn(cn); containerCollection.AddCn(cn1); containerCollection.AddCv(cv); containerCollection.AddCv(cv2); List <Container> cLastRow = new List <Container>(); cLastRow = ship.ListForLastRow(containerCollection.GetCn(), containerCollection.GetCv()); bool bCool = false; //Last Row doesn't contain cooled containers Stack stack = new Stack(); //act ship.AddFirstLastRow(cLastRow, bCool); //assert foreach (Row row in ship.GetRows()) { row.GetStacks(); Assert.IsTrue(row.GetStacks().Last().BValuable); Assert.IsFalse(row.GetStacks().First().BValuable); } }