Example #1
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.");
        }
        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!");
        }
Example #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.");
        }
Example #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.");
        }
Example #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.");
        }
Example #6
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");
        }