示例#1
0
        public void TestConfigWriteDispatchedEndDelegateCalled()
        {
            var end = false;

            var service = new ServiceController() {
                ServiceLoaderProxy = new MockServiceLoaderProxy(),
                WriteServiceConfigEnd = controller => end = true
            };

            service.WriteServiceConfig();

            Assert.IsTrue(end);

            service.Dispose();
        }
示例#2
0
        public void TestConfigWriteDispatchedBeginDelegateCalled()
        {
            var begin = false;

            var service = new ServiceController() {
                ServiceLoaderProxy = new MockServiceLoaderProxy(),
                WriteServiceConfigBegin = controller => begin = true
            };

            service.WriteServiceConfig();

            Assert.IsTrue(begin);

            service.Dispose();
        }
示例#3
0
        public void TestConfigWriteDispatchedSuccess()
        {
            var service = new ServiceController() {
                ServiceLoaderProxy = new MockServiceLoaderProxy()
            };

            service.WriteServiceConfig();

            Assert.IsTrue(((MockServiceLoaderProxy)service.ServiceLoaderProxy).OnWriteConfig);

            service.Dispose();
        }
示例#4
0
        public void TestExceptionLoggedOnTimeout()
        {
            var service = new ServiceController() {
                ServiceLoaderProxy = new MockSlowServiceLoaderProxy() {
                    WriteConfigSleep = 500
                },
                Settings = {
                    WriteServiceConfigTimeout = 10
                }
            };

            service.WriteServiceConfig();

            Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles());
            Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0);

            service.Dispose();
        }
示例#5
0
        public void TestExceptionLogged()
        {
            var service = new ServiceController() {
                ServiceLoaderProxy = new MockNonSerializableServiceLoaderProxy()
            };

            service.WriteServiceConfig();

            Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles());
            Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0);

            service.Dispose();
        }