public string CompareTo(FirstClass other) { (int selfClarity, int tieClarity) = CompareScore(this._clarity, other._clarity); (int selfOriginality, int tieOriginality) = CompareScore(this._originality, other._originality); (int selfDifficulty, int tieDifficulty) = CompareScore(this._difficulty, other._difficulty); int self = selfClarity + selfOriginality + selfDifficulty; int tie = tieClarity + tieOriginality + tieDifficulty; int that = 3 - (self + tie); return($"{self} {that}"); }
public void FirstClassAliceWinsAll() { // Arrange FirstClass alice = new FirstClass(1, 0, 1); FirstClass bob = new FirstClass(0, 0, 0); // Act string actualAlice = alice.CompareTo(bob); string actualBob = bob.CompareTo(alice); // Assert string expectedAlice = "2 0"; string expectedBob = "0 2"; actualAlice.Should().Be(expectedAlice); actualBob.Should().Be(expectedBob); }