本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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());
}