Exemple #1
0
        public void QueryFirstAsyncNull()
        {
            var response = new QueryFirstResponse();
            var channel  = new TestRequestChannel(response);

            channel.Invoking(c => c.QueryFirstAsync(null))
            .Should().Throw <ArgumentNullException>();
        }
Exemple #2
0
        public async Task QueryFirstAsync()
        {
            var response = new QueryFirstResponse();
            var request  = new QueryFirstRequest();
            var channel  = new TestRequestChannel(response);

            var ret = await channel.QueryFirstAsync(request);

            ret
            .Should().BeSameAs(response);

            channel.Request
            .Should().BeSameAs(request);
        }
Exemple #3
0
        /// <summary>
        /// Invokes the QueryFirst service.
        /// </summary>
        public IServiceResponse QueryFirst(IServiceRequest incoming)
        {
            QueryFirstResponse response = null;

            QueryFirstRequest request = (QueryFirstRequest)incoming;

            QueryDataSetCollection queryDataSets = null;
            byte[] continuationPoint = null;
            ParsingResultCollection parsingResults = null;
            DiagnosticInfoCollection diagnosticInfos = null;
            ContentFilterResult filterResult = null;

            response = new QueryFirstResponse();

            response.ResponseHeader = ServerInstance.QueryFirst(
               request.RequestHeader,
               request.View,
               request.NodeTypes,
               request.Filter,
               request.MaxDataSetsToReturn,
               request.MaxReferencesToReturn,
               out queryDataSets,
               out continuationPoint,
               out parsingResults,
               out diagnosticInfos,
               out filterResult);

            response.QueryDataSets     = queryDataSets;
            response.ContinuationPoint = continuationPoint;
            response.ParsingResults    = parsingResults;
            response.DiagnosticInfos   = diagnosticInfos;
            response.FilterResult      = filterResult;

            return response;
        }
Exemple #4
0
        /// <summary>
        /// Initializes the message with a service fault.
        /// </summary>
        public QueryFirstResponseMessage(ServiceFault ServiceFault)
        {
            this.QueryFirstResponse = new QueryFirstResponse();

            if (ServiceFault != null)
            {
                this.QueryFirstResponse.ResponseHeader = ServiceFault.ResponseHeader;
            }
        }
Exemple #5
0
 /// <summary>
 /// Initializes the message with the body.
 /// </summary>
 public QueryFirstResponseMessage(QueryFirstResponse QueryFirstResponse)
 {
     this.QueryFirstResponse = QueryFirstResponse;
 }
Exemple #6
0
        /// <summary cref="IServiceMessage.CreateResponse" />
        public object CreateResponse(IServiceResponse response)
        {
            QueryFirstResponse body = response as QueryFirstResponse;

            if (body == null)
            {
                body = new QueryFirstResponse();
                body.ResponseHeader = ((ServiceFault)response).ResponseHeader;
            }

            return new QueryFirstResponseMessage(body);
        }