Exemplo n.º 1
0
        public void TestIfSettingsModelIsUsedBySettingsInSimulation()
        {
            //arrange
            Simulation    test_Simulation;
            StartupScreen test_startupscreen;
            string        test_path;


            //act
            test_startupscreen = new StartupScreen();

            test_startupscreen.Settings = new SettingsModel
            {
                AmountOfMaids      = 3,
                ElevatorDuration   = 3,
                ElevatorCapicity   = 3,
                HTEPerSeconds      = 3,
                StairsDuration     = 3,
                CinemaDuration     = 3,
                RestaurantCapicity = 3,
                RestaurantDuration = 3,
                EatingDuration     = 3,
                FitnessCapicity    = 3,
            };

            test_path = Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout");
            test_startupscreen.layout = test_startupscreen.ReadLayoutJson(test_path);

            test_Simulation          = new Simulation(test_startupscreen, test_startupscreen.layout, test_startupscreen.Settings);
            test_Simulation.Settings = test_startupscreen.Settings;

            //assert
            Assert.AreEqual(3, test_Simulation.Settings.EatingDuration);
        }
Exemplo n.º 2
0
        public void TestIfJsonFileIsEmptyOrNot()
        {
            //arrange
            StartupScreen test_startupscreen;

            //act
            test_startupscreen = new StartupScreen();

            //assert
            Assert.IsNotNull(test_startupscreen.ReadLayoutJson(Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout")));
        }
Exemplo n.º 3
0
        public void TestIfCallElevatorIsWorkingOnGuestRequest()
        {
            //arrange
            Simulation    test_Simulation;
            StartupScreen test_startupscreen;
            string        test_path;
            Hotel         HotelTest;
            Guest         g;
            ElevatorCart  elevator;
            IArea         Areatest;

            //act
            test_startupscreen = new StartupScreen();

            test_startupscreen.Settings = new SettingsModel
            {
                AmountOfMaids      = 3,
                ElevatorDuration   = 3,
                ElevatorCapicity   = 3,
                HTEPerSeconds      = 3,
                StairsDuration     = 3,
                CinemaDuration     = 3,
                RestaurantCapicity = 3,
                RestaurantDuration = 3,
                EatingDuration     = 3,
                FitnessCapicity    = 3,
            };

            test_path = Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout");
            test_startupscreen.layout = test_startupscreen.ReadLayoutJson(test_path);
            test_Simulation           = new Simulation(test_startupscreen, test_startupscreen.layout, test_startupscreen.Settings);
            test_Simulation.Settings  = test_startupscreen.Settings;


            HotelTest = new Hotel(test_startupscreen.layout, test_startupscreen.Settings, new JsonHotelBuilder());
            g         = new Guest(null, "SUPERMAN BOB", 155, new System.Drawing.Point(5, 5), 10);

            elevator = new ElevatorCart(new System.Drawing.Point(0, 1), HotelTest, 5);
            Areatest = new Room();


            g.FinalDes = Areatest;

            HotelTest.CallElevator(g);
            elevator.RequestElevator(g, 5);
            Areatest.Position = new System.Drawing.Point(5, 5);

            elevator.RequestList.Add(g);


            //assert
            Assert.AreNotEqual(0, elevator.RequestList.Count);
        }
Exemplo n.º 4
0
        public void TestIfPathIsNotFound()
        {
            //arrange
            StartupScreen test_startupscreen;
            string        test_path;

            //act
            test_startupscreen        = new StartupScreen();
            test_path                 = Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout");
            test_startupscreen.layout = test_startupscreen.ReadLayoutJson(test_path);

            //assert
            Assert.IsNull(test_startupscreen.layout);
        }
Exemplo n.º 5
0
        public void TestIfCurrentValueOfMoveableMethodIsFilledWithData()
        {
            //arrange
            Simulation    test_Simulation;
            StartupScreen test_startupscreen;
            string        test_path;
            Hotel         HotelTest;
            Guest         g;
            List <string> ListTest;

            //act
            test_startupscreen = new StartupScreen();

            test_startupscreen.Settings = new SettingsModel
            {
                AmountOfMaids      = 3,
                ElevatorDuration   = 3,
                ElevatorCapicity   = 3,
                HTEPerSeconds      = 3,
                StairsDuration     = 3,
                CinemaDuration     = 3,
                RestaurantCapicity = 3,
                RestaurantDuration = 3,
                EatingDuration     = 3,
                FitnessCapicity    = 3,
            };

            test_path = Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout");
            test_startupscreen.layout = test_startupscreen.ReadLayoutJson(test_path);
            test_Simulation           = new Simulation(test_startupscreen, test_startupscreen.layout, test_startupscreen.Settings);
            test_Simulation.Settings  = test_startupscreen.Settings;
            ListTest = new List <string>();


            HotelTest = new Hotel(test_startupscreen.layout, test_startupscreen.Settings, new JsonHotelBuilder());
            g         = new Guest(null, "Arthas died as Lich King", 155, new System.Drawing.Point(5, 5), 10);

            ListTest = new List <string>();

            ListTest = HotelTest.CurrentValue();

            //assert
            Assert.AreEqual(ListTest, HotelTest.CurrentValue());
        }
Exemplo n.º 6
0
        public void TestHotelGetAreaMethodReturnArea()
        {
            //arrange
            Simulation    test_Simulation;
            StartupScreen test_startupscreen;
            string        test_path;
            Hotel         HotelTest;
            IArea         AreaTest;


            //act
            test_startupscreen = new StartupScreen();

            test_startupscreen.Settings = new SettingsModel
            {
                AmountOfMaids      = 3,
                ElevatorDuration   = 3,
                ElevatorCapicity   = 3,
                HTEPerSeconds      = 3,
                StairsDuration     = 3,
                CinemaDuration     = 3,
                RestaurantCapicity = 3,
                RestaurantDuration = 3,
                EatingDuration     = 3,
                FitnessCapicity    = 3,
            };

            test_path = Path.GetFullPath(Directory.GetCurrentDirectory() + @"..\..\..\..\HotelSimulationTheLock\Assets\Libraries\Hotel_reparatie.layout");
            test_startupscreen.layout = test_startupscreen.ReadLayoutJson(test_path);
            test_Simulation           = new Simulation(test_startupscreen, test_startupscreen.layout, test_startupscreen.Settings);
            test_Simulation.Settings  = test_startupscreen.Settings;

            HotelTest         = new Hotel(test_startupscreen.layout, test_startupscreen.Settings, new JsonHotelBuilder());
            AreaTest          = new Room();
            AreaTest.Position = new Point(5, 5);
            Point locationTest = new Point(5, 5);

            HotelTest.HotelAreas.Add(AreaTest);

            //assert
            Assert.AreNotEqual(AreaTest, HotelTest.GetArea(AreaTest.Position));
        }