public void Piano_FindKey_WhenKeyDoesNotExist_ShouldReturnNull() { // Arrange Piano p = new Piano(); // Act PianoKey pk = p.FindKey(4, "Q", false); // Assert Assert.IsNull(pk); }
public void Piano_FindKey_WhenKeyExists_ShouldReturnKey() { // Arrange Piano p = new Piano(); // Act PianoKey pk = p.FindKey(4, "C", false); // Assert Assert.AreEqual("C", pk.Name); Assert.AreEqual(4, pk.Octave); Assert.AreEqual(false, pk.Black); }
public void Piano_Enable_WhenKeyDoesNotExist_ShouldDoNothing() { // Arrange Piano p = new Piano(); int oct = Piano.BASE_OCTAAF + Piano.OCTAVEN; string letter = "C"; bool special = false; // Act p.Enable(oct, letter, special); // Assert Assert.IsNull(p.FindKey(oct, letter, special)); }
public void Piano_Enable_WhenKeyExists_ShouldSetEnabledToTrue() { // Arrange Piano p = new Piano(); int oct = Piano.BASE_OCTAAF; string letter = "C"; bool special = false; // Act p.Enable(oct, letter, special); // Assert PianoKey pk = p.FindKey(oct, letter, special); Assert.IsNotNull(pk); Assert.IsTrue(pk.Enabled); }
public void Piano_ResetAll() { // Arrange Piano p = new Piano(); int oct = Piano.BASE_OCTAAF; string letter = "C"; bool special = false; // Act p.Enable(oct, letter, special); p.ResetAll(); // Asset PianoKey pk = p.FindKey(oct, letter, special); Assert.IsNotNull(pk); Assert.IsFalse(pk.Enabled); }