예제 #1
0
        public async Task Doesnt_Update_OutMessage_If_No_MessageLocation_Can_Be_Found()
        {
            // Arrange
            string knownId = "known-id-" + Guid.NewGuid();

            GetDataStoreContext.InsertOutMessage(
                new OutMessage(knownId)
            {
                MessageLocation = null
            });

            var ctx = new MessagingContext(
                AS4Message.Create(new FilledUserMessage(knownId)),
                MessagingContextMode.Unknown)
            {
                SendingPMode = CreateNotifyAllSendingPMode()
            };

            var sut = new UpdateReceivedAS4MessageBodyStep(StubConfig.Default, GetDataStoreContext, _messageBodyStore);

            // Act
            await sut.ExecuteAsync(ctx);

            // Assert
            GetDataStoreContext.AssertOutMessage(knownId, m => Assert.Null(m.MessageLocation));
        }
예제 #2
0
        private async Task ExerciseUpdateReceivedMessage(
            AS4Message as4Message,
            SendingProcessingMode sendPMode,
            ReceivingProcessingMode receivePMode)
        {
            // We need to mimick the retrieval of the SendingPMode.
            MessagingContext ctx = CreateMessageReceivedContext(as4Message, sendPMode, receivePMode);

            var sut = new UpdateReceivedAS4MessageBodyStep(StubConfig.Default, GetDataStoreContext, _messageBodyStore);
            MessagingContext savedResult = await ExecuteSaveReceivedMessage(ctx);

            await sut.ExecuteAsync(savedResult);
        }
예제 #3
0
        public Property Updates_Bundled_MessageUnits_For_Delivery()
        {
            return(Prop.ForAll(
                       CreateUserReceiptArb(),
                       messageUnits =>
            {
                // Before
                Assert.All(
                    messageUnits,
                    u => GetDataStoreContext.InsertInMessage(
                        new InMessage(u.MessageId)
                {
                    EbmsMessageType = u is UserMessage
                                    ? MessageType.UserMessage
                                    : MessageType.Receipt
                }));

                // Arrange
                var sut = new UpdateReceivedAS4MessageBodyStep(
                    StubConfig.Default,
                    GetDataStoreContext,
                    _messageBodyStore);

                var ctx = new MessagingContext(
                    AS4Message.Create(messageUnits),
                    MessagingContextMode.Receive)
                {
                    SendingPMode = CreateNotifyAllSendingPMode(),
                    ReceivingPMode = CreateDeliveryReceivingPMode()
                };

                // Act
                sut.ExecuteAsync(ctx)
                .GetAwaiter()
                .GetResult();

                // Assert
                Operation UpdatedOperationOf(MessageType t)
                => t == MessageType.UserMessage
                            ? Operation.ToBeDelivered
                            : Operation.ToBeNotified;

                IEnumerable <InMessage> updates =
                    GetDataStoreContext.GetInMessages(
                        m => ctx.AS4Message.MessageIds.Contains(m.EbmsMessageId));

                Assert.All(
                    updates,
                    u => Assert.Equal(UpdatedOperationOf(u.EbmsMessageType), u.Operation));
            }));
        }