当前位置: 首页>>代码示例>>C#>>正文


C# Solver.SolutionSequence方法代码示例

本文整理汇总了C#中Solver.SolutionSequence方法的典型用法代码示例。如果您正苦于以下问题:C# Solver.SolutionSequence方法的具体用法?C# Solver.SolutionSequence怎么用?C# Solver.SolutionSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solver的用法示例。


在下文中一共展示了Solver.SolutionSequence方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_no_solution

        public void Test_no_solution()
        {
            var value = 4;
            var capacities = new[] { 3, 5 };

            var pouringGeneratorFactory = MockRepository.GenerateStrictMock<IPouringGeneratorFactory>();
            var pouringGenerator = MockRepository.GenerateStrictMock<IPouringGenerator>();

            var solver = new Solver(
                pouringGeneratorFactory
            );

            pouringGeneratorFactory
                .Expect(f => f.Create(capacities.Length))
                .Return(pouringGenerator);

            pouringGenerator
                .Stub(g => g.GetNextGeneration(null))
                .IgnoreArguments()
                .Return(Enumerable.Empty<Pouring>());

            var solutions = solver
                .SolutionSequence(value, capacities)
                .ToArray();

            Assert.AreEqual(0, solutions.Length);
        }
开发者ID:timurgaitov,项目名称:waterpouring,代码行数:27,代码来源:SolverTest.cs

示例2: Test_all_capacities_are_less_than_the_value

        public void Test_all_capacities_are_less_than_the_value()
        {
            var value = 6;
            var capacities = new[] { 3, 5 };

            var pouringGeneratorFactory = MockRepository.GenerateStrictMock<IPouringGeneratorFactory>();

            var solver = new Solver(
                pouringGeneratorFactory
            );

            var solutions = solver
                .SolutionSequence(value, capacities)
                .ToArray();

            Assert.AreEqual(0, solutions.Length);
        }
开发者ID:timurgaitov,项目名称:waterpouring,代码行数:17,代码来源:SolverTest.cs

示例3: Test_no_capacity_set

        public void Test_no_capacity_set()
        {
            var value = 4;
            var capacities = new int[0];

            var pouringGeneratorFactory = MockRepository.GenerateStrictMock<IPouringGeneratorFactory>();
            var pouringGenerator = MockRepository.GenerateStrictMock<IPouringGenerator>();

            var solver = new Solver(
                pouringGeneratorFactory
            );

            pouringGeneratorFactory
                .Expect(f => f.Create(capacities.Length))
                .Return(pouringGenerator);

            var solutions = solver
                .SolutionSequence(value, capacities)
                .ToArray();

            Assert.AreEqual(0, solutions.Length);
        }
开发者ID:timurgaitov,项目名称:waterpouring,代码行数:22,代码来源:SolverTest.cs

示例4: Test_only_one_capacity_set

        public void Test_only_one_capacity_set()
        {
            var value = 4;
            var capacities = new[] { 5 };

            var pouringGeneratorFactory = MockRepository.GenerateStrictMock<IPouringGeneratorFactory>();
            var pouringGenerator = MockRepository.GenerateStrictMock<IPouringGenerator>();

            var solver = new Solver(
                pouringGeneratorFactory
            );

            pouringGeneratorFactory
                .Expect(f => f.Create(capacities.Length))
                .Return(pouringGenerator);

            var solutionPouring = new Pouring(capacities, new[] { value }, null, null);

            pouringGenerator
                .Stub(g => g.GetNextGeneration(null))
                .IgnoreArguments()
                .Return(new[]
                {
                    solutionPouring,
                });

            var solutions = solver
                .SolutionSequence(value, capacities)
                .ToArray();

            Assert.AreEqual(1, solutions.Length);
            Assert.AreEqual(solutionPouring, solutions[0].States().Last());
        }
开发者ID:timurgaitov,项目名称:waterpouring,代码行数:33,代码来源:SolverTest.cs


注:本文中的Solver.SolutionSequence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。