Exemplo n.º 1
0
        public void HandlesObserver()
        {
            var crud         = new BeanCrud(new InMemoryStorage(), null, null, null);
            var auditorLight = new AuditorLight();
            var tracer       = new TracingObserver();

            crud.AddObserver(auditorLight);
            crud.AddObserver(tracer);
            Assert.True(crud.HasObservers());
            Assert.True(crud.IsObserverLoaded <AuditorLight>());
            Assert.True(crud.IsObserverLoaded <TracingObserver>());

            crud.AddObserver(auditorLight);
            Assert.Equal(auditorLight, crud.GetObserver <AuditorLight>());

            crud.RemoveObserver <TracingObserver>();
            Assert.False(crud.IsObserverLoaded <TracingObserver>());

            Assert.True(crud.HasObservers());
        }