public void service_on_stopTracking_if_enetity_is_iMemento_removes_self()
        {
            ChangeTrackingService svc = new ChangeTrackingService();

            Person p = new Person( svc );
            p.Name = "Foo";

            svc.Detach( p );

            var actual = ( ( IMemento )p ).Memento;
            Assert.IsNull( actual );
        }
        public void service_on_stopTracking_raise_trackingServiceStateChanged()
        {
            Int32 expected = 1;
            Int32 actual = 0;
            ChangeTrackingService svc = new ChangeTrackingService();

            Person p = new Person( svc );
            p.Name = "Foo";

            svc.TrackingServiceStateChanged += ( s, e ) => { actual++; };
            svc.Detach( p );

            Assert.AreEqual<Int32>( expected, actual );
        }
        public void service_on_stopTracking_removes_every_reference_to_entity()
        {
            EntityTrackingStates expected = EntityTrackingStates.None;

            ChangeTrackingService svc = new ChangeTrackingService();

            Person p = new Person( svc );
            p.Name = "Foo";

            svc.Detach( p );
            EntityTrackingStates actual = svc.GetEntityState( p );

            Assert.AreEqual<EntityTrackingStates>( expected, actual );
        }