コード例 #1
0
        public IShip ParseToDistributor(IShip ship, IList <IContainer> containers)
        {
            IContainerDistributor distributor = new ContainerDistributor(ship, containers);
            IShip          iShip = distributor.Distribute();
            ShipRuleTester test  = new ShipRuleTester(iShip, distributor);

            Error  = (test.TestMaximumWeight() || test.TestMinimumWeight() || test.TestBalance() || test.TestSlotWeightMaxCapacity() || test.TestContainersLeftOver());
            Reason = test.Reason;
            return(iShip);
        }
コード例 #2
0
        public void TestShipFailureMinimumWeight()
        {
            IShip FailureShip = new Ship(4, 4, 60000000, containerList);
            IContainerDistributor nastyDistribute = new ContainerDistributor(FailureShip, containerList);
            ShipRuleTester        ruleTester      = new ShipRuleTester(FailureShip, nastyDistribute);

            bool FailureMinimumWeightTest = ruleTester.TestMinimumWeight();

            Assert.IsTrue(FailureMinimumWeightTest);
        }