Esempio n. 1
0
        public void test_constructor_injected_proxy()
        {
            ClientInjectionClass _testClass = null;

            using (var lifetime = container.BeginLifetimeScope())
            {
                using (_testClass = new ClientInjectionClass(container.Resolve <Client.Contracts.IProductoService>(),
                                                             container.Resolve <Client.Contracts.IPedidoService>()))
                {
                    {
                        Client.Entities.Producto[] _productos = _testClass.GetProducto();
                        Client.Entities.Pedido[]   _pedidos   = _testClass.GetPedido();

                        Assert.That(_productos.Count(), Is.EqualTo(1));
                        Assert.That(_pedidos.Count(), Is.EqualTo(1));
                    }
                }
            }

            Assert.That((_testClass._productoProxy as ProductoClient).State, Is.EqualTo(CommunicationState.Closed));
            Assert.That((_testClass._pedidoProxy as PedidoClient).State, Is.EqualTo(CommunicationState.Closed));
        }
        public void test_constructor_injected_proxy()
        {
            ClientInjectionClass _testClass = null;

            using (var lifetime = container.BeginLifetimeScope())
            {
                using (_testClass = new ClientInjectionClass(container.Resolve <Client.Contracts.IArticleService>(),
                                                             container.Resolve <Client.Contracts.IBlogService>()))
                {
                    {
                        Client.Entities.Article[] _articles = _testClass.GetArticles();
                        Client.Entities.Blog      _blog     = _testClass.GetBlogById(1);

                        Assert.That(_articles.Count(), Is.EqualTo(1));
                        Assert.That(_blog, Is.Not.Null);
                        Assert.That(_blog.IsValid, Is.EqualTo(true));
                    }
                }
            }

            Assert.That((_testClass._articleProxy as ArticleClient).State, Is.EqualTo(CommunicationState.Closed));
            Assert.That((_testClass._blogProxy as BlogClient).State, Is.EqualTo(CommunicationState.Closed));
        }
        public void test_constructor_injected_proxy()
        {
            ClientInjectionClass _testClass = null;

            using (var lifetime = container.BeginLifetimeScope())
            {
                using (_testClass = new ClientInjectionClass(container.Resolve<Client.Contracts.IArticleService>(),
                   container.Resolve<Client.Contracts.IBlogService>()))
                {
                    {
                        Client.Entities.Article[] _articles = _testClass.GetArticles();
                        Client.Entities.Blog _blog = _testClass.GetBlogById(1);

                        Assert.That(_articles.Count(), Is.EqualTo(1));
                        Assert.That(_blog, Is.Not.Null);
                        Assert.That(_blog.IsValid, Is.EqualTo(true));
                    }
                }
            }

            Assert.That((_testClass._articleProxy as ArticleClient).State, Is.EqualTo(CommunicationState.Closed));
            Assert.That((_testClass._blogProxy as BlogClient).State, Is.EqualTo(CommunicationState.Closed));
        }