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();
        }
Example #2
0
        public void TestJunkMessageReturnsFalse()
        {
            var service = new ServiceController();

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

            service.Dispose();
        }
Example #3
0
        public void TestHelpMessageReturnsTrue()
        {
            var service = new ServiceController();

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

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

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

            service.Dispose();
        }
        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();
        }
Example #6
0
        public void TestNullMessageReturnsFalse()
        {
            var service = new ServiceController();

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

            service.Dispose();
        }
Example #7
0
        public void TestStatisticsMessageReturnsTrue()
        {
            var service = new ServiceController();

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

            service.Dispose();
        }
        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();
        }