Esempio n. 1
0
        public void CanExportFromFactoryObjectIfObjectTypeIsInterface()
        {
            using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
            {
                MockRepository mocks = new MockRepository();
                IFactoryObject simpleCounterFactory = (IFactoryObject)mocks.DynamicMock(typeof(IFactoryObject));
                Expect.Call(simpleCounterFactory.ObjectType).Return(typeof(ISimpleCounter));
                Expect.Call(simpleCounterFactory.IsSingleton).Return(true);
                Expect.Call(simpleCounterFactory.GetObject()).Return(new SimpleCounter());

                mocks.ReplayAll();

                of.RegisterSingleton("simpleCounter", simpleCounterFactory);
                SaoExporter saoExporter = new SaoExporter();
                saoExporter.ObjectFactory = of;
                saoExporter.TargetName    = "simpleCounter";
                saoExporter.ServiceName   = "RemotedSaoCallCounter";
                saoExporter.AfterPropertiesSet();
                of.RegisterSingleton("simpleCounterExporter", saoExporter); // also tests SaoExporter.Dispose()!

                AssertExportedService(saoExporter.ServiceName, 2);

                mocks.VerifyAll();
            }
        }
Esempio n. 2
0
 public void BailsIfTargetNotFound()
 {
     using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
     {
         SaoExporter saoExporter = new SaoExporter();
         saoExporter.ObjectFactory = of;
         saoExporter.TargetName = "DOESNOTEXIST";
         saoExporter.ServiceName = "RemotedSaoSingletonCounter";
         saoExporter.AfterPropertiesSet();
     }
 }
Esempio n. 3
0
 public void BailsIfTargetNotFound()
 {
     using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
     {
         SaoExporter saoExporter = new SaoExporter();
         saoExporter.ObjectFactory = of;
         saoExporter.TargetName    = "DOESNOTEXIST";
         saoExporter.ServiceName   = "RemotedSaoSingletonCounter";
         saoExporter.AfterPropertiesSet();
     }
 }
Esempio n. 4
0
        public void ExportSingleton()
        {
            using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
            {
                of.RegisterSingleton("simpleCounter", new SimpleCounter());
                SaoExporter saoExporter = new SaoExporter();
                saoExporter.ObjectFactory = of;
                saoExporter.TargetName = "simpleCounter";
                saoExporter.ServiceName = "RemotedSaoSingletonCounter";
                saoExporter.AfterPropertiesSet();
                of.RegisterSingleton("simpleCounterExporter", saoExporter); // also tests SaoExporter.Dispose()!

                AssertExportedService(saoExporter.ServiceName, 2);
            }
        }
Esempio n. 5
0
        public void ExportSingleCall()
        {
            using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
            {
                of.RegisterObjectDefinition("simpleCounter", new RootObjectDefinition(typeof(SimpleCounter), false));
                SaoExporter saoExporter = new SaoExporter();
                saoExporter.ObjectFactory = of;
                saoExporter.TargetName    = "simpleCounter";
                saoExporter.ServiceName   = "RemotedSaoSingleCallCounter";
                saoExporter.AfterPropertiesSet();
                of.RegisterSingleton("simpleCounterExporter", saoExporter); // also tests SaoExporter.Dispose()!

                AssertExportedService(saoExporter.ServiceName, 0);
            }
        }
Esempio n. 6
0
        public void CanExportFromFactoryObjectIfObjectTypeIsInterface()
        {
            using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
            {
                IFactoryObject simpleCounterFactory = A.Fake <IFactoryObject>();
                A.CallTo(() => simpleCounterFactory.ObjectType).Returns(typeof(ISimpleCounter));
                A.CallTo(() => simpleCounterFactory.IsSingleton).Returns(true);
                A.CallTo(() => simpleCounterFactory.GetObject()).Returns(new SimpleCounter());


                of.RegisterSingleton("simpleCounter", simpleCounterFactory);
                SaoExporter saoExporter = new SaoExporter();
                saoExporter.ObjectFactory = of;
                saoExporter.TargetName    = "simpleCounter";
                saoExporter.ServiceName   = "RemotedSaoCallCounter";
                saoExporter.AfterPropertiesSet();
                of.RegisterSingleton("simpleCounterExporter", saoExporter); // also tests SaoExporter.Dispose()!

                AssertExportedService(saoExporter.ServiceName, 2);
            }
        }
Esempio n. 7
0
 public void BailsWhenNotConfigured()
 {
     SaoExporter exp = new SaoExporter();
     exp.AfterPropertiesSet();
 }
Esempio n. 8
0
        public void CanExportFromFactoryObjectIfObjectTypeIsInterface()
        {
            using (DefaultListableObjectFactory of = new DefaultListableObjectFactory())
            {
                MockRepository mocks = new MockRepository();
                IFactoryObject simpleCounterFactory = (IFactoryObject) mocks.DynamicMock(typeof (IFactoryObject));
                Expect.Call(simpleCounterFactory.ObjectType).Return(typeof (ISimpleCounter));
                Expect.Call(simpleCounterFactory.IsSingleton).Return(true);
                Expect.Call(simpleCounterFactory.GetObject()).Return(new SimpleCounter());

                mocks.ReplayAll();

                of.RegisterSingleton("simpleCounter", simpleCounterFactory);
                SaoExporter saoExporter = new SaoExporter();
                saoExporter.ObjectFactory = of;
                saoExporter.TargetName = "simpleCounter";
                saoExporter.ServiceName = "RemotedSaoCallCounter";
                saoExporter.AfterPropertiesSet();
                of.RegisterSingleton("simpleCounterExporter", saoExporter); // also tests SaoExporter.Dispose()!

                AssertExportedService(saoExporter.ServiceName, 2);

                mocks.VerifyAll();
            }
        }
Esempio n. 9
0
        public void BailsWhenNotConfigured()
        {
            SaoExporter exp = new SaoExporter();

            exp.AfterPropertiesSet();
        }
Esempio n. 10
0
        public void BailsWhenNotConfigured()
        {
            SaoExporter exp = new SaoExporter();

            Assert.Throws <ArgumentException>(() => exp.AfterPropertiesSet());
        }
 public void BailsWhenNotConfigured()
 {
     SaoExporter exp = new SaoExporter();
     Assert.Throws<ArgumentException>(() => exp.AfterPropertiesSet());
 }