Example #1
0
        public void TestVariableEnabledPortThenEnabled() {
            var commandServer = new CommandServerController();

            commandServer.Shared.Variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    CommonVariableNames.CommandServerPort,
                    3100
                })
            });

            commandServer.Shared.Variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    CommonVariableNames.CommandServerEnabled,
                    true
                })
            });

            commandServer.Execute();
            
            Assert.IsNotNull(commandServer.CommandServerListener);
            Assert.IsNotNull(commandServer.CommandServerListener.Listener);

            commandServer.Dispose();
        }
Example #2
0
        public void TestCommandServerDisposed() {
            var commandServer = new CommandServerController();

            commandServer.Dispose();

            Assert.IsNull(commandServer.CommandServerListener);
            Assert.IsNull(commandServer.TunnelObjects);
        }
Example #3
0
        public void TestEventLoggedOnConfiguredDisabled() {
            var commandServer = new CommandServerController();

            commandServer.Shared.Variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    CommonVariableNames.CommandServerPort,
                    3500
                })
            });

            commandServer.Shared.Variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    CommonVariableNames.CommandServerEnabled,
                    true
                })
            });

            commandServer.Execute();

            commandServer.Shared.Variables.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = TestHelpers.ObjectListToContentList(new List<Object>() {
                    CommonVariableNames.CommandServerEnabled,
                    false
                })
            });

            Assert.IsNotEmpty(commandServer.Shared.Events.LoggedEvents);
            Assert.AreEqual(GenericEventType.CommandServerStopped, commandServer.Shared.Events.LoggedEvents.First(e => e.GenericEventType == GenericEventType.CommandServerStopped).GenericEventType);
            Assert.AreEqual(CommandResultType.Success, commandServer.Shared.Events.LoggedEvents.First(e => e.GenericEventType == GenericEventType.CommandServerStarted).CommandResultType);
            Assert.IsTrue(commandServer.Shared.Events.LoggedEvents.First(e => e.GenericEventType == GenericEventType.CommandServerStarted).Success);

            commandServer.Dispose();
        }