public void Test_GetAllCustomersOverWCF()
 {
     CustomerQueryServiceReference.CustomerQueryServiceClient query = new CustomerQueryServiceReference.CustomerQueryServiceClient();
       Common.Util.AssignContextId(query.InnerChannel);
       Customer[] results = query.All();
       int count = results.Length;
       Assert.That(count, Is.GreaterThan(0));
 }
Exemplo n.º 2
0
        public ServiceClient Initialise()
        {
            try
              {
            string contextId = Guid.NewGuid().ToString();

            _custQueryClient = new OrderProcessing.CustomerQueryServiceReference.CustomerQueryServiceClient();
            Common.Util.SetContextId(_custQueryClient.InnerChannel, contextId);
            _custQueryClient.Open();

            _orderQueryClient = new OrderProcessing.OrderQueryServiceReference.OrderQueryServiceClient();
            Common.Util.SetContextId(_orderQueryClient.InnerChannel, contextId);
            _orderQueryClient.Open();

            _empQueryClient = new OrderProcessing.EmployeeQueryServiceReference.EmployeeQueryServiceClient();
            Common.Util.SetContextId(_empQueryClient.InnerChannel, contextId);
            _empQueryClient.Open();

            _cmdClient = new OrderProcessing.CommandServiceReference.CommandServiceClient();
            Common.Util.SetContextId(_cmdClient.InnerChannel, contextId);
            _cmdClient.Open();

            _prodQueryClient = new OrderProcessing.ProductQueryServiceReference.ProductQueryServiceClient();
            Common.Util.SetContextId(_prodQueryClient.InnerChannel, contextId);
            _prodQueryClient.Open();

            _handler = new NotificationHandler();
            InstanceContext cntx = new InstanceContext(_handler);

            _subscriptionClient = new OrderProcessing.SubscriptionServiceReference.SubscriptionServiceClient(cntx);
            SubscriptionClient.Open();
            SubscriptionClient.Subscribe();

              }
              catch (Exception ex)
              {
            throw;
              }

              return this;
        }
        public void Test_GetSingleCustomersOverWCF()
        {
            CustomerQueryServiceReference.CustomerQueryServiceClient query = new CustomerQueryServiceReference.CustomerQueryServiceClient();
            Common.Util.AssignContextId(query.InnerChannel);
            ClientQuery<Customer> c = new ClientQuery<Customer>();
            IQueryable q = c.Where(c1 => c1.CustomerId == "ALFKI");
            XElement xe = q.SerializeQuery();
            Customer results = query.Where(xe);

            Assert.That(results, Is.Not.Null);
        }