Exemplo n.º 1
0
        public void LogInFailAlreadyLoggedIn()
        {
            SpotifyPlayer          player  = CreateInitializedPlayer();
            Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify);

            wrapper.Setup(s => s.LogIn());
            player.LogIn();
            wrapper.Verify(s => s.LogIn(), Times.Exactly(1));
            wrapper.ResetCalls();

            player.LogIn();

            Assert.AreEqual(PlayerState.Stopped, player.State);
        }
Exemplo n.º 2
0
        private SpotifyPlayer CreateLoggedInPlayer()
        {
            SpotifyPlayer          player  = CreateInitializedPlayer();
            Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify);

            wrapper.Setup(s => s.LogIn());
            player.LogIn();
            wrapper.ResetCalls();
            return(player);
        }
Exemplo n.º 3
0
        public void LogOutSuccess()
        {
            SpotifyPlayer          player  = CreateInitializedPlayer();
            Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify);

            wrapper.Setup(s => s.LogIn());
            player.LogIn();
            wrapper.Setup(p => p.LogOut());

            player.LogOut();

            wrapper.Verify(p => p.LogOut(), Times.Exactly(1));
            Assert.AreEqual(PlayerState.Stopped, player.State);
        }
Exemplo n.º 4
0
        public void TryStartPlaylistFailed()
        {
            SpotifyPlayer          player  = CreateInitializedPlayer();
            Mock <ISpotifyWrapper> wrapper = Mock.Get(player.Spotify);

            wrapper.Setup(s => s.LogIn());
            player.LogIn();
            wrapper.ResetCalls();
            wrapper.Setup(s => s.TryStartPlaylist("test playlist", true)).Returns(false);

            player.TryStartPlaylist("test playlist", true);

            wrapper.Verify(s => s.TryStartPlaylist("test playlist", true), Times.Exactly(1));
            Assert.AreEqual(PlayerState.Stopped, player.State);
        }