public void SolveReturningStatusFail() { var sut = new OrangeSolver(); var actualResult = sut.Solve(CreateModel()); Assert.That(actualResult.Status, Is.EqualTo(SolveStatus.Fail)); }
public void SolveWithModelReturnsStatusSuccess() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); Assert.That(actualResult.Status, Is.EqualTo(SolveStatus.Success)); }
public void SolveReturningStatusSuccess() { var sut = new OrangeSolver(); var actualResult = sut.Solve(CreateWorkspace().Model); Assert.That(actualResult.Status, Is.EqualTo(SolveStatus.Success)); }
public void SolveReturningLabelYInValidRange() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var yLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("y"); Assert.That(yLabel.GetValueAsInt(), Is.InRange(1, 2)); }
public void SolveWithModelSatisfiesValueCount() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var c = actualSnapshot.GetAggregateLabelByVariableName("c"); Assert.That(c.Values.Count, Is.EqualTo(10)); }
public void SolveWithModelCreatesValidSolution() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var c = actualSnapshot.GetAggregateLabelByVariableName("c"); Assert.That(c.GetValueAt(0), Is.InRange(1, 9)); }
public void SolveReturningLabelInValidRange() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var colsLabel = actualResult.Snapshot.GetAggregateLabelByVariableName("cols"); Assert.That(colsLabel.Values, Is.All.InRange(1, 4)); }
public void SolveReturningLabelSatisfiesConstraint() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var colsLabel = actualResult.Snapshot.GetAggregateLabelByVariableName("cols"); Assert.That(colsLabel.GetValueAt(1), Is.Not.EqualTo(2)); }
public void SolveReturningLabelSatisfyingConstraint() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var colsLabel = actualResult.Snapshot.GetAggregateLabelByVariableName("cols"); var xLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("x"); Assert.That(colsLabel.Values, Is.All.GreaterThan(xLabel.Value)); }
public void SolveReturningLabelsSatisfyConstraint() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var aLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("A"); var bLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("B"); Assert.That(aLabel.GetValueAsInt(), Is.GreaterThan(bLabel.GetValueAsInt())); }
public void SolveWithAllDifferentModelSolutionHasValidVariableCount() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; Assert.That(actualSnapshot.SingletonLabels, Is.Empty); Assert.That(actualSnapshot.AggregateLabels.Count, Is.EqualTo(1)); }
public void SolveWithAllDifferentModelSatisfiesAllDifferentConstraint() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var xLabel = actualSnapshot.GetAggregateLabelByVariableName("x"); Assert.That(xLabel.Values, Is.Unique); }
public void SolveWithModelSatisfiesConstraints() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var c = actualSnapshot.GetAggregateLabelByVariableName("c"); Assert.That(c.GetValueAt(0), Is.LessThan(c.GetValueAt(9))); Assert.That(c.GetValueAt(1), Is.GreaterThan(c.GetValueAt(8))); }
public void Solve_With_Simple_Model_Satisfies_Constraint() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var x = actualSnapshot.GetSingletonLabelByVariableName("x"); var y = actualSnapshot.GetSingletonLabelByVariableName("y"); Assert.That(x.Value, Is.Not.EqualTo(y.Value)); }
public void SolveReturningLabelSatisfyingConstraint() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var xLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("x"); var yLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("y"); Assert.That(xLabel.Value, Is.Not.EqualTo(yLabel.Value)); }
public void SolveWithSimpleModelSolutionHasValidVariableCount() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var singletonVariableCount = actualSnapshot.SingletonLabels.Count; var aggregateVariableCount = actualSnapshot.AggregateLabels.Count; Assert.That(singletonVariableCount, Is.EqualTo(3)); Assert.That(aggregateVariableCount, Is.EqualTo(0)); }
public void SolveReturningLabelInValidRange() { var sut = new OrangeSolver(); var simpleModel = CreateWorkspace().Model; var actualResult = sut.Solve(simpleModel); var xLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("x"); var yLabel = actualResult.Snapshot.GetSingletonLabelByVariableName("y"); Assert.That(xLabel.Value, Is.AnyOf("red", "blue")); Assert.That(yLabel.Value, Is.AnyOf("red", "blue")); }
public void SolveWithExpressionModelSatisfiesConstraints() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var x = actualSnapshot.GetSingletonLabelByVariableName("x"); var y = actualSnapshot.GetSingletonLabelByVariableName("y"); Assert.That(x.GetValueAsInt() + 1, Is.Not.EqualTo(y.GetValueAsInt() - 1)); }
public void Solve_With_Simple_Model_Solution_Within_Domain() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var x = actualSnapshot.GetSingletonLabelByVariableName("x"); var y = actualSnapshot.GetSingletonLabelByVariableName("y"); Assert.That(x.Value, Is.InRange(1, 9)); Assert.That(y.Value, Is.InRange(1, 9)); }
public void Solve_With_Model_Satisfies_Constraint() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var x = actualSnapshot.GetSingletonLabelByVariableName("x"); var y = actualSnapshot.GetSingletonLabelByVariableName("y"); var z = actualSnapshot.GetAggregateLabelByVariableName("z"); Assert.That(x.Value, Is.LessThan(y.Value)); Assert.That(y.Value, Is.GreaterThan(z.GetValueAt(0))); }
public void SolveWithAllDifferentModelSatisfiesAllDifferentConstraint() { var sut = new OrangeSolver(); var actualResult = sut.Solve(MakeModel()); var actualSnapshot = actualResult.Snapshot; var xLabel = actualSnapshot.GetSingletonLabelByVariableName("x"); var yLabel = actualSnapshot.GetSingletonLabelByVariableName("y"); var zLabel = actualSnapshot.GetSingletonLabelByVariableName("z"); Assert.That(xLabel.Value, Is.Not.EqualTo(yLabel.Value)); Assert.That(xLabel.Value, Is.Not.EqualTo(zLabel.Value)); Assert.That(yLabel.Value, Is.Not.EqualTo(zLabel.Value)); }