Esempio n. 1
0
        public void ValidateGetVehicleMethod()
        {
            var garage = new AutomatedWarehouse("MyStorage");

            Assert.That(() => garage.GetVehicle(2),
                        Throws.InvalidOperationException.With.Message.EqualTo("Invalid garage slot!"));

            Assert.That(() => garage.GetVehicle(1),
                        Throws.InvalidOperationException.With.Message.EqualTo("No vehicle in this garage slot!"));

            Assert.That(garage.GetVehicle(0).GetType().Name, Is.EqualTo("Truck"));
        }
Esempio n. 2
0
        public void TestAutomatedWarehouseUnloadProductReturnsTheCorrectNumberOfUnloadedProducts()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");
            var ram = new Ram(123);

            automatedWarehouse.GetVehicle(0).LoadProduct(ram);
            automatedWarehouse.GetVehicle(0).LoadProduct(ram);
            automatedWarehouse.GetVehicle(0).LoadProduct(ram);
            automatedWarehouse.GetVehicle(0).LoadProduct(ram);
            automatedWarehouse.GetVehicle(0).LoadProduct(ram);

            Assert.AreEqual(automatedWarehouse.UnloadVehicle(0), 5, "Doesnt unload the correct number of products");
        }
Esempio n. 3
0
        public void TestAutomatedWarehouseProperyProductsReturnsTheCorrectElements()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");
            var hardDirve          = new HardDrive(123);

            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.UnloadVehicle(0);
            Assert.AreEqual(automatedWarehouse.Products.ElementAt(0), hardDirve, "Product is not the same as expected.");
        }
Esempio n. 4
0
        public void TestAutomatedWarehousePropertyIsFullReturnsFalse()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");
            var ram = new Ram(123);

            automatedWarehouse.GetVehicle(0).LoadProduct(ram);
            automatedWarehouse.UnloadVehicle(0);
            Assert.IsFalse(automatedWarehouse.IsFull, "AutomatedWarehouse should not be full.");
        }
Esempio n. 5
0
        public void TestAutomatedWarehousePropertyIsFullReturnsTrue()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");
            var hardDirve          = new HardDrive(123);

            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.UnloadVehicle(0);
            Assert.IsTrue(automatedWarehouse.IsFull, "AutomatedWarehouse should be full.");
        }
        public void SendVehcileToShouldWorkCorectly()
        {
            int index = 0;
            AutomatedWarehouse automatedWarehouse = new AutomatedWarehouse("Automated");
            int result = storage.SendVehicleTo(index, automatedWarehouse);

            Assert.AreEqual(result, 1, "The target place is not correct!");
            Assert.Throws <InvalidOperationException>(() => storage.GetVehicle(index), "Do not delete vehicle from source location!");

            Assert.AreEqual(automatedWarehouse.GetVehicle(result).GetType(), typeof(Semi), "The sent vehicle is not of the same type!");
        }
        public void UnloadVehicleShouldThrowsInvalidOperationExceptionIfStorageIsFull()
        {
            AutomatedWarehouse automatedWarehouse = new AutomatedWarehouse("House");
            int     garageSlot = 0;
            Vehicle vehicle    = automatedWarehouse.GetVehicle(garageSlot);

            vehicle.LoadProduct(new HardDrive(5000));
            vehicle.LoadProduct(new HardDrive(200));
            automatedWarehouse.UnloadVehicle(garageSlot);

            Assert.That(() => automatedWarehouse.UnloadVehicle(garageSlot),
                        Throws.InvalidOperationException
                        .With.Message.EqualTo("Storage is full!")
                        , "When stotage is full does not throws exception!");
        }
Esempio n. 8
0
        public void TestAutomatedWarehouseUnloadProductThrowsExceptionWhenStorageIsfull()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");
            var hardDirve          = new HardDrive(123);

            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            automatedWarehouse.UnloadVehicle(0);
            automatedWarehouse.GetVehicle(0).LoadProduct(hardDirve);
            Assert.Throws <InvalidOperationException>(() => automatedWarehouse.UnloadVehicle(0), "Doesnt Throw Exception when storage house if full.");
        }
Esempio n. 9
0
        public void TestAutomatedWarehouseGetVehicleReturnsExistingVehicleInTheGarrage(int target)
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");

            Assert.AreEqual(automatedWarehouse.GetVehicle(target).GetType().Name, typeof(Truck).Name, "Does not return the same type vehicle.");
        }
Esempio n. 10
0
        public void TestAutomatedWarehouseGetVehicleThrowsExceptionWhenAccessingNullGarageSlot()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");

            Assert.Throws <InvalidOperationException>(() => automatedWarehouse.GetVehicle(1), "AutomatedWarehouse returns non existing vehicle.");
        }