public void CandidateEqualityTest() { var candidate = new SingleStepSolution.Candidate(1, 2, 3); var otherCandidate = new SingleStepSolution.Candidate(1, 2, 3); Assert.That(candidate != null); Assert.That(null != candidate); Assert.That(candidate == otherCandidate); Assert.That(candidate.Equals(otherCandidate)); Assert.That(candidate.Equals((object)otherCandidate)); Assert.That(candidate.GetHashCode() == otherCandidate.GetHashCode()); var rowDiffers = new SingleStepSolution.Candidate(0, 2, 3); Assert.That(candidate != rowDiffers); var columnDiffers = new SingleStepSolution.Candidate(1, 0, 3); Assert.That(candidate != columnDiffers); var valueDiffers = new SingleStepSolution.Candidate(1, 2, 0); Assert.That(candidate != valueDiffers); candidate = null; otherCandidate = null; Assert.That(candidate == otherCandidate); }
public void ConstructorArgumentValidationTest() { var eliminations = new SingleStepSolution.Candidate[0]; Assert.That(() => new SingleStepSolution(null, "test"), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => new SingleStepSolution(eliminations, null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => new SingleStepSolution(eliminations, string.Empty), Throws.InstanceOf <ArgumentException>()); Assert.That(() => new SingleStepSolution(0, 0, 0, null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => new SingleStepSolution(0, 0, 0, string.Empty), Throws.InstanceOf <ArgumentException>()); }
public void CandidateToStringTest() { var candidate = new SingleStepSolution.Candidate(1, 2, 3); Assert.That(candidate.ToString(), Is.EqualTo("[1,2] - 3")); }