Exemplo n.º 1
0
        public void NetServiceCollection_Initialized_ServiceInitialized()
        {
            NetServiceCollection c = new NetServiceCollection();

            c.Register <TestNetService>();
            c.LockServices();
            c.InitializeServices(new NetContext());

            Assert.IsTrue(c.Get <TestNetService>().Initialized == true);
        }
Exemplo n.º 2
0
        public void NetServiceCollection_GetServices_HasServices()
        {
            NetServiceCollection c = new NetServiceCollection();

            c.Register <TestNetService>();
            c.LockServices();

            Assert.IsTrue(c.ServiceList.Count() == 1);
            Assert.IsTrue(c.ServiceList.First() == c.Get <TestNetService>());
        }
Exemplo n.º 3
0
        public void NetServiceCollection_RegisterService_HasService()
        {
            NetServiceCollection c = new NetServiceCollection();

            c.Register <TestNetService>();
            c.LockServices();

            var result = c.Get <TestNetService>();

            Assert.IsNotNull(result);
        }
Exemplo n.º 4
0
        public void NetServiceCollection_Disposed_ServiceDisposed()
        {
            NetServiceCollection c = new NetServiceCollection();

            c.Register <TestNetService>();
            c.LockServices();
            var svc = c.Get <TestNetService>();

            c.Dispose();

            Assert.IsTrue(svc.Disposed == true);
        }
Exemplo n.º 5
0
        public void NetServiceCollection_RegisterServiceWithConfigure_ServiceConfigured()
        {
            NetServiceCollection c = new NetServiceCollection();

            c.Register <TestNetService>();
            c.Configure <TestNetService>((o) => { o.Configured = true; });
            c.LockServices();

            var svc = c.Get <TestNetService>();

            Assert.IsNotNull(svc);
            Assert.IsTrue(svc.Configured);
        }