public void Add_2CooledContainers_MoreThan30tons_Error()
        {
            //arrange
            ContainerCollection containerCollection = new ContainerCollection(2, 2); //assumption is to add two cooled containers
            Container           container           = new Container {
                Weight = 31, IsRefrigerated = true
            };
            Container container1 = new Container {
                Weight = 32, IsRefrigerated = true
            };

            //act
            containerCollection.AddCc(container);
            containerCollection.AddCc(container1);

            //assert
            Assert.AreEqual(0, containerCollection.GetCc().Count);
        }
Exemple #2
0
        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 Check_TotalLoadWeight_Ship20ton_Add_TwoCcContainers_4Ton_False()
        {
            //arrange
            Ship ship = new Ship(2, 2, 20);

            ContainerCollection containerCollection = new ContainerCollection(2, 2); //assumption is to add two cooled containers
            Container           container           = new Container {
                Weight = 31, IsRefrigerated = true
            };
            Container container1 = new Container {
                Weight = 32, IsRefrigerated = true
            };

            containerCollection.AddCc(container);
            containerCollection.AddCc(container1);

            //act

            ship.CheckLoadWeight(containerCollection.GetCn(), containerCollection.GetCv(), containerCollection.GetCc());
            //assert
            Assert.IsFalse(ship.CheckLoadWeight(containerCollection.GetCn(), containerCollection.GetCv(), containerCollection.GetCc()));
        }