Ejemplo n.º 1
0
        public void TestMergeMessageWithParametersCallsMerge()
        {
            var merged = false;

            var service = new ServiceController() {
                Settings = {
                    ServiceUpdateCore = false
                },
                Packages = new MockServicePackageManager() {
                    PackageInstalled = (sender, uri, packageId) => { merged = true; }
                }
            };

            service.SignalMessage(new ServiceMessage() {
                Name = "merge",
                Arguments = new Dictionary<string, string>() {
                    { "uri", "localhost" },
                    { "packageid", "id" }
                }
            });

            Assert.IsTrue(merged);

            service.Dispose();
        }
Ejemplo n.º 2
0
        public void TestJunkMessageReturnsFalse()
        {
            var service = new ServiceController();

            Assert.IsFalse(service.SignalMessage(new ServiceMessage() {
                Name = "junk"
            }));

            service.Dispose();
        }
Ejemplo n.º 3
0
        public void TestHelpMessageReturnsTrue()
        {
            var service = new ServiceController();

            Assert.IsTrue(service.SignalMessage(new ServiceMessage() {
                Name = "help"
            }));

            service.Dispose();
        }
Ejemplo n.º 4
0
        public void TestMergeMessageReturnsTrue()
        {
            var service = new ServiceController() {
                Settings = {
                    ServiceUpdateCore = false
                }
            };

            Assert.IsTrue(service.SignalMessage(new ServiceMessage() {
                Name = "merge"
            }));

            service.Dispose();
        }
Ejemplo n.º 5
0
        public void TestSignalBeginCallback()
        {
            var signaled = false;

            var service = new ServiceController() {
                Settings = {
                    ServiceUpdateCore = false
                },
                SignalBegin = (controller, message) => signaled = true
            };

            service.SignalMessage(new ServiceMessage() {
                Name = "help"
            });

            Assert.IsTrue(signaled);

            service.Dispose();
        }
Ejemplo n.º 6
0
        public void TestNullMessageReturnsFalse()
        {
            var service = new ServiceController();

            Assert.IsFalse(service.SignalMessage(null));

            service.Dispose();
        }
Ejemplo n.º 7
0
        public void TestStatisticsMessageReturnsTrue()
        {
            var service = new ServiceController();

            Assert.IsTrue(service.SignalMessage(new ServiceMessage() {
                Name = "statistics"
            }));

            service.Dispose();
        }
Ejemplo n.º 8
0
        public void TestSignalParameterError()
        {
            var error = false;

            var service = new ServiceController() {
                Settings = {
                    ServiceUpdateCore = false
                },
                SignalParameterError = (controller, list) => error = true
            };

            service.SignalMessage(new ServiceMessage() {
                Name = "merge",
                Arguments = new Dictionary<string, string>() {
                    { "uri", "localhost" }
                }
            });

            Assert.IsTrue(error);

            service.Dispose();
        }