public void DisposeInitialized() { SpotifyPlayer player = CreateInitializedPlayer(); Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify); wrapper.Setup(w => w.Dispose()); player.Dispose(); wrapper.Verify(w => w.Dispose(), Times.Exactly(1)); Assert.IsNull(player.Spotify); Assert.AreEqual(PlayerState.Stopped, player.State); }
public void DisposePlaying() { SpotifyPlayer player = CreatePlayingSpotifyPlayer(); Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify); wrapper.Setup(w => w.Dispose()); wrapper.Setup(w => w.LogOut()); wrapper.Setup(w => w.StopMusic()); player.Dispose(); wrapper.Verify(w => w.StopMusic(), Times.Exactly(1)); wrapper.Verify(w => w.LogOut(), Times.Exactly(1)); wrapper.Verify(w => w.Dispose(), Times.Exactly(1)); Assert.IsNull(player.Spotify); Assert.AreEqual(PlayerState.Stopped, player.State); }