Пример #1
0
        private void AddContainers_Click(object sender, EventArgs e)
        {
            int amount = (int)numUDContainerAmount.Value;

            dock.AddContainer(ContainerFactory.GenerateRandomContainers(amount, seed));

            VisualiseContainers();
        }
Пример #2
0
        public void AddContainer_Test()
        {
            //Arrange
            List <ShipContainer> expected = ContainerFactory.GenereateSpecificContainer(7000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Cooled, 10);

            //Act
            Test_Dock.AddContainer(expected);

            //Assert
            Assert.AreEqual(expected.Count, Test_Dock.unassignedContainers.Count);
        }
Пример #3
0
        public void SolveContainer_Test_01()
        {
            //Arrange
            List <ShipContainer> Containers = ContainerFactory.GenerateRandomContainers(100, seed);

            Test_Dock.AddContainer(Containers);
            bool expected = false;

            //Act
            bool actual = Test_Dock.AssignContainers();

            //Assert
            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void MaxValueable_Test()
        {
            //Arrange
            Dock dock = new Dock();

            dock.AssignShip(new System.Drawing.Size(2, 2), 20000);
            List <ShipContainer> valueableContainers = ContainerFactory.GenereateSpecificContainer(4000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Regular, 5);

            dock.AddContainer(valueableContainers);
            dock.AssignContainers();

            List <ShipContainer> container = ContainerFactory.GenereateSpecificContainer(4000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Valueable, 5);
            //Act
            bool actual = dock.AddRegularContainers(container);

            //Assert
            Assert.AreNotEqual(true, actual);
        }
Пример #5
0
        public void Impossible_Test()
        {
            //Arrange
            Dock dock = new Dock();

            dock.AssignShip(new System.Drawing.Size(1, 2), 20000);

            List <ShipContainer> cooledContainers = ContainerFactory.GenereateSpecificContainer(1000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Cooled, 10);

            dock.AddContainer(cooledContainers);
            dock.AssignContainers();

            //Act
            var actual = dock.Ship.CheckBalance(false);

            //Assert
            Assert.AreNotEqual(ContainerMovement_V2.Objects.Enums.Types.Sides.Left, actual);
        }
Пример #6
0
        public void LeftSide_Test()
        {
            //Arrange
            Dock dock = new Dock();

            dock.AssignShip(new System.Drawing.Size(4, 2), 100000);

            List <ShipContainer> containersLeft = ContainerFactory.GenereateSpecificContainer(4000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Regular, 12);

            foreach (var c in containersLeft)
            {
                dock.Ship.AddRegularContainer(c, ContainerMovement_V2.Objects.Enums.Types.Sides.Left);
            }

            List <ShipContainer> testContainers = ContainerFactory.GenereateSpecificContainer(5000, ContainerMovement_V2.Objects.Enums.Types.ContainerTypes.Regular, 10);

            //Act
            dock.AddContainer(testContainers);
            var side = dock.Ship.CheckBalance(false);

            //Assert

            Assert.AreEqual(ContainerMovement_V2.Objects.Enums.Types.Sides.Right, side);
        }