public void TestJustSendMessageByHttp()
        {
            foreach (var dataService in DataServices)
            {
                // Arrange.
                var requestBody          = string.Empty;
                var message              = InitTestData("http://localhost:2525", TransportType.HTTP, dataService);
                var statisticsService    = GetMockStatisticsService();
                var subscriptionsManager = new DefaultSubscriptionsManager(dataService, statisticsService);
                var component            = new DefaultSendingManager(
                    subscriptionsManager,
                    statisticsService,
                    dataService,
                    GetMockLogger());

                using (WebApp.Start("http://localhost:2525/Message", (builder) =>
                {
                    builder.Run((context) =>
                    {
                        requestBody = new StreamReader(context.Request.Body).ReadToEnd();
                        return(context.Response.WriteAsync(string.Empty));
                    });
                }))
                {
                    // Act.
                    Act(component);

                    // Assert.
                    Assert.True(ValidateRequest(requestBody, message, TransportType.HTTP));
                    Assert.Equal(0, dataService.GetObjectsCount(LoadingCustomizationStruct.GetSimpleStruct(typeof(Message), Message.Views.MessageListView)));
                }
            }
        }
 private void Act(DefaultSendingManager component)
 {
     component.Prepare();
     component.Start();
     Thread.Sleep(component.ScanningPeriodMilliseconds);
     component.Stop();
     component.AfterStop();
 }
Beispiel #3
0
        public void TestStartStop()
        {
            var service = new DefaultSendingManager(
                GetMockSubscriptionManager(),
                new Mock <IStatisticsService>().Object,
                GetMockDataService(),
                GetMockLogger());

            RunSBComponentFullCycle(service);
        }
        public void TestJustSendMessageByWcf()
        {
            foreach (var dataService in DataServices)
            {
                // Arrange.
                var requestBody          = string.Empty;
                var message              = InitTestData("http://*****:*****@"<s:Envelope xmlns:s=""http://www.w3.org/2003/05/soap-envelope"">
                                <s:Header />
                                <s:Body>
                                    <AcceptMessageResponse xmlns=""http://tempuri.org/"" />
                                </s:Body>
                            </s:Envelope>"));
                    });
                }))
                {
                    // Act.
                    Act(component);

                    // Assert.
                    Assert.True(ValidateRequest(requestBody, message, TransportType.WCF));
                    Assert.Equal(0, dataService.GetObjectsCount(LoadingCustomizationStruct.GetSimpleStruct(typeof(Message), Message.Views.MessageListView)));
                }
            }
        }