public void CheckIfLoadVehicleThrowsExpection() { Storagemaster storageMaster = new Storagemaster(); storageMaster.RegisterStorage("Warehouse", "storage"); storageMaster.SelectVehicle("storage", 1); List <string> productsToLoad = new List <string>() { "Gpu", "HardDrive" }; Assert.Throws <InvalidOperationException>(() => storageMaster.LoadVehicle(productsToLoad)); }
public void SelectVehicleIfWorkingProperly() { Storagemaster storageMaster = new Storagemaster(); var field = typeof(Storagemaster) .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) .First(f => f.Name == StorageRegistryName); storageMaster.RegisterStorage("Warehouse", "warehouse"); Dictionary <string, Storage> storageRegistry = (Dictionary <string, Storage>)field.GetValue(storageMaster); string actual = storageMaster.SelectVehicle("warehouse", 1); string expected = $"Selected Semi"; Assert.AreEqual(expected, actual); }
public void CheckIfLoadVehicleWorksCorrectly() { Storagemaster storageMaster = new Storagemaster(); storageMaster.RegisterStorage("Warehouse", "storage"); storageMaster.SelectVehicle("storage", 1); storageMaster.AddProduct("Gpu", 12); storageMaster.AddProduct("HardDrive", 120); List <string> productsToLoad = new List <string>() { "Gpu", "HardDrive" }; storageMaster.LoadVehicle(productsToLoad); FieldInfo vehicleField = typeof(Storagemaster) .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) .First(f => f.Name == CurrentVehicleName); Vehicle vehicle = (Vehicle)vehicleField.GetValue(storageMaster); Assert.AreEqual(2, vehicle.Trunk.Count); }