Пример #1
0
        public void simplest_usage()
        {
            // SAMPLE: simple-remote-service-runner
            var runner = new RemoteServiceRunner(x => {
                x.ServiceDirectory      = @"c:\code\other-service\src\other-service";
                x.Setup.ShadowCopyFiles = true.ToString();
            });

            // stop and restart the remote AppDomain
            runner.Recycle();

            // There is support for event aggregation between
            // AppDomain's for coordination
            runner.SendRemotely(new SomeMessage());

            // Shut down and close the remote AppDomain
            runner.Dispose();

            // ENDSAMPLE
        }
        public void copy_assembly_once_by_default()
        {
            using (var runner = new RemoteServiceRunner(x =>
            {
                x.UseParallelServiceDirectory("ApplicationLoaderService");
                x.RequireAssemblyContainingType<SampleService.SampleService>();
            }))
            {
                var path = ".".ToFullPath();
                var sampleServiceDll = path.AppendPath("bin/Debug/SampleService.dll");

                File.SetLastWriteTime(sampleServiceDll, new DateTime(2014, 01, 01));
                var originalWriteTime = File.GetLastWriteTime(sampleServiceDll);

                runner.Recycle();

                var newWriteTime = File.GetLastWriteTime(sampleServiceDll);

                newWriteTime.ShouldBe(originalWriteTime);
            }
        }
Пример #3
0
        public void copy_assembly_once_by_default()
        {
            using (var runner = new RemoteServiceRunner(x =>
            {
                x.UseParallelServiceDirectory("ApplicationLoaderService");
                x.RequireAssemblyContainingType <SampleService.SampleService>();
            }))
            {
                var path             = ".".ToFullPath();
                var sampleServiceDll = path.AppendPath("bin/Debug/SampleService.dll");

                File.SetLastWriteTime(sampleServiceDll, new DateTime(2014, 01, 01));
                var originalWriteTime = File.GetLastWriteTime(sampleServiceDll);

                runner.Recycle();

                var newWriteTime = File.GetLastWriteTime(sampleServiceDll);

                newWriteTime.ShouldBe(originalWriteTime);
            }
        }
Пример #4
0
        public void copy_new_remote_assembly_over_old_assembly_when_copymode_always()
        {
            using (var runner = new RemoteServiceRunner(x =>
            {
                x.AssemblyCopyMode = AssemblyCopyMode.Always;
                x.UseParallelServiceDirectory("ApplicationLoaderService");
                x.RequireAssemblyContainingType <SampleService.SampleService>();
            }))
            {
                var path             = ".".ToFullPath();
                var sampleServiceDll = path.AppendPath("bin/Debug/SampleService.dll");

                File.SetLastWriteTime(sampleServiceDll, new DateTime(2014, 01, 01));
                var originalWriteTime = File.GetLastWriteTime(sampleServiceDll);

                runner.Recycle();

                var newWriteTime = File.GetLastWriteTime(sampleServiceDll);

                newWriteTime.ShouldBeGreaterThan(originalWriteTime);
                originalWriteTime.ShouldNotBe(newWriteTime);
            }
        }
        public void copy_new_remote_assembly_over_old_assembly_when_copymode_always()
        {
            using (var runner = new RemoteServiceRunner(x =>
            {
                x.AssemblyCopyMode = AssemblyCopyMode.Always;
                x.UseParallelServiceDirectory("ApplicationLoaderService");
                x.RequireAssemblyContainingType<SampleService.SampleService>();
            }))
            {
                var path = ".".ToFullPath();
                var sampleServiceDll = path.AppendPath("bin/Debug/SampleService.dll");

                File.SetLastWriteTime(sampleServiceDll, new DateTime(2014, 01, 01));
                var originalWriteTime = File.GetLastWriteTime(sampleServiceDll);

                runner.Recycle();

                var newWriteTime = File.GetLastWriteTime(sampleServiceDll);

                newWriteTime.ShouldBeGreaterThan(originalWriteTime);
                originalWriteTime.ShouldNotBe(newWriteTime);
            }
        }
        public void simplest_usage()
        {
            // SAMPLE: simple-remote-service-runner
            var runner = new RemoteServiceRunner(x => {
                x.ServiceDirectory = @"c:\code\other-service\src\other-service";
                x.Setup.ShadowCopyFiles = true.ToString();
            });

            // stop and restart the remote AppDomain
            runner.Recycle();

            // There is support for event aggregation between
            // AppDomain's for coordination
            runner.SendRemotely(new SomeMessage());

            // Shut down and close the remote AppDomain
            runner.Dispose();

            // ENDSAMPLE
        }