Exemplo n.º 1
0
 public void ServiceCanBeStartedAndStopped()
 {
     using (WcfService <FeatureStoreService> service = new WcfService <FeatureStoreService>())
     {
         service.Start();
     }
 }
        public WcfInteropFixture()
        {
            // Arrange.
            TestNCS = new NameCommentStruct {
                Comment = "Comm", Id = "Test", Name = "Name"
            };
            var address = new Uri("http://localhost:12344/ServiceBusInterop");

            SubManager = new Mock <ISubscriptionsManager>();
            SubManager.Setup(sub => sub.GetSubscriptions(It.IsAny <string>(), It.IsAny <bool>()))
            .Returns(new[]
            {
                new Subscription()
                {
                    MessageType = new MessageType()
                    {
                        ID = TestNCS.Id, Description = TestNCS.Comment, Name = TestNCS.Name
                    }
                }
            });
            service = new WcfService(SubManager.Object, GetMockSendingManager(), GetMockReceivingManager(), GetMockLogger(), GetMockStatisticsService(), GetMockObjectRepository())
            {
                UseWcfSettingsFromConfig = false,
                Binding = new BasicHttpBinding(),
                Address = address
            };

            var binding = new BasicHttpBinding();

            ServiceBus = new ChannelFactory <IServiceBusInterop>(binding, new EndpointAddress(address)).CreateChannel();
            service.Start();
        }
Exemplo n.º 3
0
 /// <summary>
 ///   When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.
 /// </summary>
 /// <param name = "args">Data passed by the start command.</param>
 protected override void OnStart(string[] args)
 {
     try
     {
         m_FeatureStoreServiceImpl.Start();
     }
     catch (Exception e)
     {
         m_Logger.Error(e);
         throw;
     }
 }
Exemplo n.º 4
0
        public void TestAccessingWcfServices()
        {
            var binding = new BasicHttpBinding();
            var address = new Uri("http://localhost:12342/SBService");
            var log     = new List <bool>();

            var subscriptionManager = GetMockSubscriptionManager();
            var sendingManager      = GetMockSendingManager();
            var receivingManager    = GetMockReceivingManager();
            var logger            = GetMockLogger();
            var statisticsService = GetMockStatisticsService();
            var objectRepository  = GetMockObjectRepository();
            var service           = new WcfService(subscriptionManager, sendingManager, receivingManager, logger, statisticsService, objectRepository)
            {
                UseWcfSettingsFromConfig = false,
                Binding = binding,
                Address = address
            };

            using (service)
            {
                service.Start();

                ThreadStart act = () =>
                {
                    var  channelFactory    = new ChannelFactory <IServiceBusService>(binding, new EndpointAddress(address));
                    var  serviceBusService = channelFactory.CreateChannel();
                    bool isUp = serviceBusService.IsUp();

                    log.Add(isUp);
                };

                Thread thread1 = new Thread(act);
                Thread thread2 = new Thread(act);

                thread1.Start();
                thread2.Start();
                thread1.Join();
                thread2.Join();

                service.Stop();
            }

            Assert.Equal(2, log.Count);
            foreach (var b in log)
            {
                Assert.True(b);
            }
        }
Exemplo n.º 5
0
        public WcfCallbackFixture()
        {
            // Arrange.
            var address = new Uri("http://localhost:12346/CallbackSubscriber");

            RecManager = new Mock <IReceivingManager>();
            service    = new WcfService(GetMockSubscriptionManager(), GetMockSendingManager(), RecManager.Object, GetMockLogger(), GetMockStatisticsService(), GetMockObjectRepository())
            {
                UseWcfSettingsFromConfig = false,
                Binding = new BasicHttpBinding(),
                Address = address
            };

            var binding = new BasicHttpBinding();

            ServiceBus = new ChannelFactory <ICallbackSubscriber>(binding, new EndpointAddress(address)).CreateChannel();
            service.Start();
        }
Exemplo n.º 6
0
        public WcfServiceFixture()
        {
            // Arrange.
            var address = new Uri("http://localhost:12345/ServiceBusService");

            SubManager  = new Mock <ISubscriptionsManager>();
            SendManager = new Mock <ISendingManager>();
            RecManager  = new Mock <IReceivingManager>();
            service     = new WcfService(SubManager.Object, SendManager.Object, RecManager.Object, GetMockLogger())
            {
                UseWcfSettingsFromConfig = false,
                Binding = new BasicHttpBinding(),
                Address = address
            };

            var binding = new BasicHttpBinding();

            ServiceBus = new ChannelFactory <IServiceBusService>(binding, new EndpointAddress(address)).CreateChannel();
            service.Start();
        }
Exemplo n.º 7
0
 /// <summary>
 /// Starts the WCF service.
 /// </summary>
 private void StartService()
 {
     m_Service = new WcfService <FeatureStoreService>();
     m_Service.Start();
 }
Exemplo n.º 8
0
 public static void ClassInitialize(TestContext context)
 {
     m_FeatureStoreService = new WcfService <FeatureStoreService>();
     m_FeatureStoreService.Start();
 }