GivenExistingEndpointsWhenQueryMessagesWithValidityPeriodThenTheResultShouldBeAnEmptySetOfMessages()
        {
            var queryMessagesService =
                new QueryMessagesService(new HttpMessagingService(HttpClient));
            var queryMessagesParameters = new QueryMessagesParameters
            {
                OnboardResponse = OnboardResponse,
                ValidityPeriod  = new ValidityPeriod()
            };

            queryMessagesParameters.ValidityPeriod.SentFrom = UtcDataService.Timestamp(TimestampOffset.FourWeeks);
            queryMessagesParameters.ValidityPeriod.SentTo   = UtcDataService.Timestamp(TimestampOffset.None);
            queryMessagesService.Send(queryMessagesParameters);

            Thread.Sleep(TimeSpan.FromSeconds(5));

            var fetchMessageService = new FetchMessageService(HttpClient);
            var fetch = fetchMessageService.Fetch(OnboardResponse);

            Assert.Single(fetch);

            var decodedMessage = DecodeMessageService.Decode(fetch[0].Command.Message);

            Assert.Equal(204, decodedMessage.ResponseEnvelope.ResponseCode);
            Assert.Equal(ResponseEnvelope.Types.ResponseBodyType.AckForFeedMessage,
                         decodedMessage.ResponseEnvelope.Type);
        }
コード例 #2
0
        GivenExistingEndpointsWhenFeedDeleteWithValidityPeriodThenTheResultShouldNotBeOkBecauseTheMessageIdsAreMissing()
        {
            var feedDeleteService    = new FeedDeleteService(new HttpMessagingService(HttpClient));
            var feedDeleteParameters = new FeedDeleteParameters
            {
                OnboardResponse = OnboardResponse,
                ValidityPeriod  = new ValidityPeriod()
            };

            feedDeleteParameters.ValidityPeriod.SentTo = UtcDataService.Timestamp(TimestampOffset.None);
            feedDeleteParameters.ValidityPeriod.SentTo = UtcDataService.Timestamp(TimestampOffset.FourWeeks);
            feedDeleteService.Send(feedDeleteParameters);

            Thread.Sleep(TimeSpan.FromSeconds(5));

            var fetchMessageService = new FetchMessageService(HttpClient);
            var fetch = fetchMessageService.Fetch(OnboardResponse);

            Assert.Single(fetch);

            var decodedMessage = DecodeMessageService.Decode(fetch[0].Command.Message);

            Assert.Equal(400, decodedMessage.ResponseEnvelope.ResponseCode);
            Assert.Equal(ResponseEnvelope.Types.ResponseBodyType.AckWithFailure,
                         decodedMessage.ResponseEnvelope.Type);

            var messages = DecodeMessageService.Decode(decodedMessage.ResponsePayloadWrapper.Details);

            Assert.NotNull(messages);
            Assert.NotEmpty(messages.Messages_);
            Assert.Single(messages.Messages_);
            Assert.Equal("VAL_000017", messages.Messages_[0].MessageCode);
            Assert.Equal(
                "messageIds information required to process message is missing or malformed.",
                messages.Messages_[0].Message_);
        }