Esempio n. 1
0
        public void TestCreateGenericSingletonService()
        {
            ServiceBase <IContract> srv;

            srv = new GenericSingletonService <IContract, ContractImplementation>();
            Assert.AreEqual("salut", srv.GetImplementation().Echo("salut"));
        }
Esempio n. 2
0
        public void TestDataPersistence()
        {
            IService srv;

            srv = new GenericSingletonService <IContract, ContractImplementation>();
            ServiceProvider container = new ServiceProvider();

            container.RegisterService <IContract>(srv);

            IContract imp;

            imp      = container.GetService <IContract>();
            imp.Name = "asdf";
            Assert.AreEqual("asdf", imp.Name);
            imp = container.GetService <IContract>();
            //verify that the name has persisted.
            Assert.AreEqual("asdf", imp.Name);
        }