private int ScoreAgainst(SecondClass other) { int self = this._clarity > other._clarity ? 1 : 0; self += this._originality > other._originality ? 1 : 0; self += this._difficulty > other._difficulty ? 1 : 0; return(self); }
public void SecondClassAliceTiesTwo() { // Arrange SecondClass alice = new SecondClass(0, 0, 1); SecondClass bob = new SecondClass(0, 0, 3); // Act string actualAlice = alice.CompareTo(bob); string actualBob = bob.CompareTo(alice); // Assert string expectedAlice = "0 1"; string expectedBob = "1 0"; actualAlice.Should().Be(expectedAlice); actualBob.Should().Be(expectedBob); }
public string CompareTo(SecondClass other) { return($"{this.ScoreAgainst(other)} {other.ScoreAgainst(this)}"); }