public void TestDistributionCenterThrowsExceptionWhenDeliveryLocationIsfull()
        {
            var distributionCenter          = new DistributionCenter("SmartSolutions");
            var automatedDistributionCenter = new AutomatedWarehouse("SmartTech");

            distributionCenter.SendVehicleTo(0, automatedDistributionCenter);


            Assert.Throws <InvalidOperationException>(() => distributionCenter.SendVehicleTo(1, automatedDistributionCenter), "Doesnt throw exception when delivery location is full.");
        }
Example #2
0
        public void SendVehicle_ShouldThrowExceptionForDistributionCenterWhenNotEmptySlotsAvailableAtDestinationStorage()
        {
            this.storage = new DistributionCenter("Test Distribution Center");

            var secondStorage = new DistributionCenter("Second Distribution Center");
            var thirdStorage  = new DistributionCenter("Third Distribution Center");

            secondStorage.SendVehicleTo(0, this.storage);
            secondStorage.SendVehicleTo(1, this.storage);

            Assert.Throws <InvalidOperationException>(() => thirdStorage.SendVehicleTo(0, this.storage));
        }
        public void TestDistributionCenterSendVehicleSendsVehiclesAndReturnsTheCorrectSlot()
        {
            var distributionCenter          = new DistributionCenter("SmartSolutions");
            var automatedDistributionCenter = new AutomatedWarehouse("SmartTech");

            Assert.AreEqual(distributionCenter.SendVehicleTo(0, automatedDistributionCenter), 1, "Doesnt return the correct added slot from delivery location.");
        }
        public void TestDistributionCenterSendVehicleSendsVehiclesAndSetsTheDeliveryLocationCorrectly()
        {
            var distributionCenter          = new DistributionCenter("SmartSolutions");
            var automatedDistributionCenter = new AutomatedWarehouse("SmartTech");

            distributionCenter.SendVehicleTo(0, automatedDistributionCenter);

            Assert.AreEqual(automatedDistributionCenter.Garage.ElementAt(1).GetType().Name, typeof(Van).Name, "When sending vehicles doesnt reflect in the delivery Storage.");
        }
        public void TestDistributionCenterSendVehicleSendsVehicles()
        {
            var distributionCenter          = new DistributionCenter("SmartSolutions");
            var automatedDistributionCenter = new AutomatedWarehouse("SmartTech");

            distributionCenter.SendVehicleTo(0, automatedDistributionCenter);

            Assert.AreEqual(distributionCenter.Garage.ElementAt(0), null, "When sending vehicles doesnt reflect in the current Storage.");
        }
Example #6
0
        public void ValidateSendVehicleToMethod()
        {
            var originStorage = new DistributionCenter("Origin");
            var targetStorage = new AutomatedWarehouse("Target");

            originStorage.SendVehicleTo(0, targetStorage);

            var originGarage = (Vehicle[])this.GetType("Storage")
                               .GetField("garage", BindingFlags.NonPublic | BindingFlags.Instance)
                               .GetValue(originStorage);

            var targetGarage = (Vehicle[])this.GetType("Storage")
                               .GetField("garage", BindingFlags.NonPublic | BindingFlags.Instance)
                               .GetValue(targetStorage);

            Assert.That(originGarage[0], Is.EqualTo(null));
            Assert.That(targetGarage[1].GetType().Name, Is.EqualTo("Van"));

            Assert.That(() => originStorage.SendVehicleTo(1, targetStorage),
                        Throws.InvalidOperationException.With.Message.EqualTo("No room in garage!"));
        }