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")); }
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"); }
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."); }
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."); }
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!"); }
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 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."); }
public void TestAutomatedWarehouseGetVehicleThrowsExceptionWhenAccessingNullGarageSlot() { var automatedWarehouse = new AutomatedWarehouse("SmartSolutions"); Assert.Throws <InvalidOperationException>(() => automatedWarehouse.GetVehicle(1), "AutomatedWarehouse returns non existing vehicle."); }