Beispiel #1
0
        public void ReadSolutionResourceOrFindSolutionEndTest2()
        {
            var data       = new KnapsackProblemDataParser();
            var constraint = KnapsackProblemDataParser.ReadSolutionResourceOrFindSolutionEnd("", data);

            Assert.IsNull(constraint);
        }
Beispiel #2
0
        public void ReadSolutionResourceOrFindSolutionEndTest1()
        {
            var data     = new KnapsackProblemDataParser();
            var resource = new Resource("R1", 5687, 6585, 0);

            data.Resources.Add(resource);

            var constraint =
                KnapsackProblemDataParser.ReadSolutionResourceOrFindSolutionEnd("\t1\t156\t5687\t6585", data);

            Assert.AreEqual(KnapsackProblemDataParser.ReadSolutionResourceOrFindSolutionEnd, constraint);
            Assert.AreSame(resource, data.Solution[0].Item);
            Assert.AreEqual(156, data.Solution[0].Quantity);
        }