예제 #1
0
        public void CanFindCommandByTrigger()
        {
            var h = new CommandHandler( MakeCommands() );
            var c = h.Get( "s" );

            Assert.AreEqual( "Second", c.Name );
        }
 public SimpleCommandLineClient( InjectionQueueCommunicator com, CommandHandler commandsfile )
 {
     _com = com;
     _current = null;
     _parser = new CommandLineParser();
     _handler = commandsfile;
 }
예제 #3
0
        public void HandlerCanListAllCommands()
        {
            var h = new CommandHandler( MakeCommands() );
            var a = h.All().ToList();

            Assert.AreEqual( 2, a.Count );
            Assert.AreEqual( "First", a[0].Name );
        }
예제 #4
0
        public void HandlerCanFetchCommandsFromFile()
        {
            File.WriteAllText( "tst.json", @"[{""Name"":""TMP"",""Trigger"":""t""}]" );
            var h = new CommandHandler( "tst.json" );
            var a = h.All().ToList();

            Assert.AreEqual( 1, a.Count );
            Assert.AreEqual( "TMP", a[0].Name );
        }