public void MusicPlayer_Play_Play_Current()
        {
            //arrange
            IMusicFactory imf = Substitute.For<IMusicFactory>();
            IInternalPlayer iip = Substitute.For<IInternalPlayer>();
            imf.GetInternalPlayer().Returns(iip);

            IReadOnlyPlayList irop = Substitute.For<IReadOnlyPlayList>();
            IInternalTrack it = Substitute.For<IInternalTrack>();
            it.Path.Returns("MyPath");
            irop.CurrentTrack.Returns(it);
            irop.When(x => x.Init()).Do(x => irop.CurrentTrack.Returns(it));

            // act
            MusicPlayer target = new MusicPlayer(imf);
            target.MonitorEvents();
            target.PlayList = irop;
            target.Stop();
            target.Mode.Should().Be(PlayMode.Stopped);
            target.Play();

            //assert
            target.PlayList.Should().Be(irop);
            target.MusicTrackSource.Should().Be(it);
            target.ShouldRaisePropertyChangeFor(t => t.PlayList);
            target.ShouldRaisePropertyChangeFor(t => t.MusicTrackSource);
            iip.FileSource.Should().Be("MyPath");
            iip.Received().Play();
            irop.DidNotReceive().Init();

            iip.Listener.Should().Be(target);

            target.Mode.Should().Be(PlayMode.Play);
        }
        public void MusicPlayer_Play_Do_NotPlay_UnderEdit()
        {
            //arrange
            IMusicFactory imf = Substitute.For<IMusicFactory>();
            IInternalPlayer iip = Substitute.For<IInternalPlayer>();
            imf.GetInternalPlayer().Returns(iip);
            iip.FileSource = null;

            IReadOnlyPlayList irop = Substitute.For<IReadOnlyPlayList>();
            IInternalTrack it = Substitute.For<IInternalTrack>();
            it.Path.Returns("MyPath");
            it.InternalState.Returns(ObjectState.UnderEdit);
            irop.CurrentTrack.Returns(it);


            // act
            MusicPlayer target = new MusicPlayer(imf);
            target.MonitorEvents();
            target.PlayList = irop;


            //assert
            target.PlayList.Should().Be(irop);
            target.MusicTrackSource.Should().Be(it);
            target.Mode.Should().Be(PlayMode.Stopped);
            target.ShouldRaisePropertyChangeFor(t => t.PlayList);
            target.ShouldRaisePropertyChangeFor(t => t.MusicTrackSource);
            iip.FileSource.Should().Be("MyPath");
            iip.DidNotReceive().Play();
            irop.DidNotReceive().Init();
            iip.Listener.Should().Be(target);

            //act2
            target.Pause();

            //assert2 
            target.Mode.Should().Be(PlayMode.Stopped);
            iip.DidNotReceive().Pause();

            //act3
            target.Stop();

            //assert3
            target.Mode.Should().Be(PlayMode.Stopped);
            iip.DidNotReceive().Play();


            //act4
            IInternalMusicPlayer iimp = target;
            it.UpdatedState.Returns(ObjectState.Available);
            it.InternalState.Returns(ObjectState.Available);
            iimp.OnLockEvent(it, new ObjectStateChangeArgs(it, ObjectState.UnderEdit, ObjectState.Available));

            target.Play();

            //assert4
            target.Mode.Should().Be(PlayMode.Play);

        }
        public void MusicPlayer_Play_Track_Null()
        {
            //arrange
            IMusicFactory imf = Substitute.For<IMusicFactory>();
            IInternalPlayer iip = Substitute.For<IInternalPlayer>();
            imf.GetInternalPlayer().Returns(iip);

            // act
            MusicPlayer target = new MusicPlayer(imf);
            target.Play();

            //assert
            target.MusicTrackSource.Should().BeNull();
            target.Mode.Should().Be(PlayMode.Stopped);

           
        }