public void TestRegistration()
        {
            MDefaultRegistry registry = new MDefaultRegistry(new MDefaultServer());

            DummyLifecycledService service = new DummyLifecycledService();

            ManagedObjectName name = new ManagedObjectName("domain.org:name=Service");

            registry.RegisterManagedObject( service, name );
            registry.UnregisterManagedObject( name );

            AssertEquals( 0, service.beforeRegisterCalled );
            AssertEquals( 1, service.afterRegisterCalled );
            AssertEquals( 2, service.beforeDeregisterCalled );
            AssertEquals( 3, service.afterDeregisterCalled );
        }
        public void TestUse()
        {
            MDefaultRegistry registry = new MDefaultRegistry(new MDefaultServer());
            AssertEquals( 0, registry.Count );

            DummyHttpServer instance = new DummyHttpServer();
            ManagedObjectName name = new ManagedObjectName("domain.org");

            ManagedInstance minstance =
                registry.RegisterManagedObject(instance, name);

            AssertNotNull( minstance );
            AssertNotNull( minstance.TypeName );
            AssertEquals( name, minstance.Name );
            AssertEquals( 1, registry.Count );
            AssertEquals( instance, registry[name] );

            registry.UnregisterManagedObject( name );

            AssertEquals( 0, registry.Count );
        }