public void A_service_configuration()
        {
            _runConfiguration = RunnerConfigurator.New(x =>
                {
                    x.SetDisplayName("chris");
                    x.SetServiceName("chris");
                    x.SetDescription("chris's pants");

                    x.ConfigureService<TestService>(c =>
                        {
                            c.WhenStarted(s => s.Start());
                            c.WhenStopped(s => s.Stop());
                            c.WhenPaused(s => { });
                            c.WhenContinued(s => { });
                            c.Named("my_service");
                        });

                    x.DoNotStartAutomatically();

                    x.RunAs("dru", "pass");

                    x.DependsOn("ServiceName");
                    x.DependencyOnMsmq();
                    x.DependencyOnMsSql();

                    x.AfterInstallingServices(() => { });
                    x.AfterUninstallingServices(() => { });
                });
        }
Example #2
0
File: Bob.cs Project: KevM/Topshelf
        public void EstablishContext()
        {
            _configuration = RunnerConfigurator.New(x =>
            {
                x.SetDescription("topshelf test installation");
                x.SetDisplayName("TOPSHELF-TEST");
                x.SetServiceName("TOPSHELF-TEST");

                x.RunAsLocalSystem();

                x.ConfigureServiceInIsolation<TestInstall>(s =>
                {
                    s.WhenStarted(tc => tc.Start());
                    s.WhenStopped(tc => tc.Stop());
                });
            });
        }
        public void EstablishContext()
        {
            TestService s1 = new TestService();
            TestService s2 = new TestService();

            _runConfiguration = (RunConfiguration)RunnerConfigurator.New(x =>
            {
                x.SetDisplayName("chris");
                x.SetServiceName("chris");
                x.SetDescription("chris's pants");

                x.ConfigureService<TestService>(c =>
                {
                    c.WhenStarted(s => s.Start());
                    c.WhenStopped(s => s.Stop());
                    c.WhenPaused(s => { });
                    c.WhenContinued(s => { });
                    c.Named("my_service");
                });

                //needs to moved to a custom area for testing
                //x.ConfigureServiceInIsolation<TestService>(c=>
                //                                                   {
                //                                                       c.WhenStarted(s => s.Start());
                //                                                       c.WhenStopped(s => s.Stop());
                //                                                       c.WhenPaused(s => { });
                //                                                       c.WhenContinued(s => { });
                //                                                       c.HowToBuildService(()=>sl);
                //                                                   });

                x.DoNotStartAutomatically();

                x.RunAs("dru", "pass");

                //x.UseWinFormHost<MyForm>();

                x.DependsOn("ServiceName");
                x.DependencyOnMsmq();
                x.DependencyOnMsSql();
            });
        }
 public void Finally()
 {
     _runConfiguration.Coordinator.Dispose();
     _runConfiguration = null;
 }