internal void Li(object sender,  ObjectStateChangeArgs os)
 {
     os.ShouldHave().AllProperties().EqualTo(Expected);
     //Assert.That(os.Equals(Expected), Is.True);
     Expected = Next;
     Next = null;
 }
 private void LifeChanges(object sender, ObjectStateChangeArgs args)
 {
     if (args.NewState == ObjectState.Removed)
     {
         IObjectState ios = args.Changed;
         ios.ObjectStateChanges -= LifeChanges;
         RawCollection.Remove(ios as Artist);              
     }
 }
        private void StateChanged(object sender, ObjectStateChangeArgs osca)
        {
            if (osca.NewState == ObjectState.Removed)
                return;

            if (osca.NewState == ObjectState.UnderEdit)
                return;

            CacheState(true); 
        }
        void IInternalMusicPlayer.OnLockEvent(object sender, ObjectStateChangeArgs e)
        {
            IInternalTrack ts = sender as IInternalTrack;
            if (ts != _TrackSource)
                throw new Exception("Lock management");

            PlayMode currentmode = Mode;

            switch (e.NewState)
            {

                case ObjectState.Available:
                    if (e.OldState != ObjectState.UnderEdit)
                        break;

                    //liberation de lock
                    if (_Foto == null)
                        return;

                    if ((_Foto.Track != ts) || (currentmode != PlayMode.Paused))
                        throw new Exception("Lock management");
                        
                    bool play = _Foto.PlayOrPaused;
                    if (play)
                    {
                        PlayFromFoto();
                    }
                  
                    break;


                case ObjectState.UnderEdit:

                    //Lock de track
                    switch (currentmode)
                    {
                        case PlayMode.Stopped:
                            RawClose();
                            break;

                        case PlayMode.Play:
                            RawPause();
                            _Foto = new PlayFoto(_TrackSource, Position, true);
                            using (Silent())
                            {
                                RawStop();
                                RawClose();
                            }
                            PrivateMode = PlayMode.Paused;
                            break;


                        case PlayMode.Paused:
                            _Foto = new PlayFoto(_TrackSource, Position, false);
                            using (Silent())
                            {
                                RawStop();
                                RawClose();
                            }
                            break;
                    }
                    break;

                case ObjectState.FileNotAvailable:

                    PlayListtransition();
                    break;
            }

        }
 private void Listener(object o, ObjectStateChangeArgs e)
 {
     throw new Exception("Ca pue");
 }