Beispiel #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"));
        }
Beispiel #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");
        }
Beispiel #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.");
        }
Beispiel #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.");
        }
Beispiel #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!");
        }
Beispiel #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.");
        }
Beispiel #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.");
        }
Beispiel #10
0
        public void TestAutomatedWarehouseGetVehicleThrowsExceptionWhenAccessingNullGarageSlot()
        {
            var automatedWarehouse = new AutomatedWarehouse("SmartSolutions");

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