Exemplo n.º 1
0
        public override XDocument FormatInternal(GetSubscriptionIdsResponse response)
        {
            var formatted = CreateResponse("EPCISQueryDocument");
            formatted.Root.Add(new XElement("EPCISBody", new XElement(XName.Get("GetSubscriptionIDsResult", EpcisNamespaces.Query), response.SubscriptionIds.Select(x => new XElement("string", x)))));

            return formatted;
        }
        public override void Given()
        {
            base.Given();

            Response = new GetSubscriptionIdsResponse {
                SubscriptionIds = new[] { "test-subscription-1" }
            };
        }
        public override void Given()
        {
            ExpectedResponse  = new GetSubscriptionIdsResponse();
            Mediator          = new Mock <IMediator>();
            Request           = new GetSubscriptionIdsRequest();
            CancellationToken = new CancellationTokenSource().Token;
            Controller        = new EpcisXmlQueryController(Mediator.Object);

            Mediator.Setup(x => x.Send(Request, CancellationToken)).Returns(() => Task.FromResult(ExpectedResponse));
        }
Exemplo n.º 4
0
 private static XElement Format(IEpcisResponse entity, CancellationToken cancellationToken)
 {
     return(entity switch
     {
         GetStandardVersionResponse standardVersion => FormatGetStandardVersionResponse(standardVersion),
         GetVendorVersionResponse vendorVersion => FormatGetVendorVersionResponse(vendorVersion),
         ExceptionResponse exception => FormatInternal(exception),
         GetQueryNamesResponse queryNames => FormatGetQueryNamesResponse(queryNames),
         GetSubscriptionIdsResponse subscriptionIds => FormatGetSubscriptionIdsResponse(subscriptionIds),
         PollResponse poll => FormatPollResponse(poll, cancellationToken),
         _ => throw new NotImplementedException($"Unable to format '{entity.GetType()}'")
     });
Exemplo n.º 5
0
 public abstract XDocument FormatInternal(GetSubscriptionIdsResponse response);
Exemplo n.º 6
0
 public override XDocument FormatInternal(GetSubscriptionIdsResponse response)
 => FormatSoap(new XElement(XName.Get("GetSubscriptionIDsResult", EpcisNamespaces.Query), response.SubscriptionIds?.Select(x => new XElement("string", x))));