示例#1
0
        public TestServiceProvider()
        {
            TestMachineName        = ".";
            ControlTimeout         = TimeSpan.FromSeconds(120);
            TestServiceName        = Guid.NewGuid().ToString();
            TestServiceDisplayName = "Test Service " + TestServiceName;

            _dependentServices = new TestServiceProvider(TestServiceName + ".Dependent");

            // Create the service
            CreateTestServices();
        }
示例#2
0
        private ServiceController ConnectToServer()
        {
            TestServiceProvider.DebugTrace("ServiceBaseTests.ConnectToServer: connecting");
            _testService.Client.Connect(connectionTimeout);
            Assert.Equal((int)PipeMessageByteCode.Connected, _testService.GetByte());
            TestServiceProvider.DebugTrace("ServiceBaseTests.ConnectToServer: received connect byte");

            ServiceController controller = new ServiceController(_testService.TestServiceName);

            AssertExpectedProperties(controller);
            return(controller);
        }
示例#3
0
        public void NoServiceNameOnServiceBase()
        {
            // When installing a service, you must supply a non empty name.
            // When a service starts itself (using StartServiceCtrlDispatcher) it's legal to pass an empty string for the name.
            string serviceName = "NoServiceNameOnServiceBase";
            var    testService = new TestServiceProvider(serviceName);

            // Ensure it has successfully written to the event log,
            // indicating it figured out its own name.
            Assert.True(EventLog.SourceExists(serviceName));

            testService.DeleteTestServices();
        }
示例#4
0
 public ServiceBaseTests()
 {
     _testService = new TestServiceProvider();
 }
示例#5
0
 public ServiceControllerTests()
 {
     _testService = new TestServiceProvider();
 }