Пример #1
0
        public void Sending_Sample_Result_In_Delivered_And_Notified_Files(
            string file,
            string consoleSettings,
            string serviceSettings,
            params string[] payloads)
        {
            // Arrange
            StartSenderMsh(consoleSettings);
            StartReceiverMsh(serviceSettings);

            // Act
            PutSample(file);

            // Wait some time till component has processed the sample
            WaitUntil(
                () => Directory.EnumerateFiles(DeliverPath, GeneratedIdPattern).Any() &&
                Directory.EnumerateFiles(NotifyReceiptPath).Any(),
                retryCount: 100,
                retryInterval: TimeSpan.FromSeconds(1));

            // TearDown
            SenderMsh.Dispose();

            // Assert
            Assert.All(payloads, m =>
            {
                AssertFiles(DeliverPath, m);

                string expected = GetOriginalPayload(m);
                string actual   = Directory.EnumerateFiles(DeliverPath, m).First();

                Console.WriteLine(@"Expect send and delivered payload to have the same hash");
                Assert.Equal(MD5Hash(expected), MD5Hash(actual));
            });

            AssertFiles(DeliverPath, GeneratedIdPattern);
            AssertSignalMessages(NotifyReceiptPath, 1);
            AssertSignalMessages(NotifyErrorPath, 0);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SampleTestTemplate"/> class.
        /// </summary>
        protected SampleTestTemplate(WindowsServiceFixture fixture)
        {
            try
            {
                _fixture = fixture;

                // ReSharper disable once InconsistentNaming
                string samples_pmodes = Path.Combine(".", "samples", "pmodes");
                CleanSlateReceivingPModesFrom(samples_pmodes);
                CleanSlateSendingPModesFrom(samples_pmodes);

                CreateOrClearDirectory(@".\messages\out");
                CreateOrClearDirectory(@".\messages\in");
                CreateOrClearDirectory(@".\messages\receipts");
                CreateOrClearDirectory(@".\messages\errors");
                CreateOrClearDirectory(@".\messages\exceptions");
            }
            catch (Exception)
            {
                SenderMsh?.Dispose();
                _fixture?.Dispose();
                throw;
            }
        }