Ejemplo n.º 1
0
 public void TestAddition()
 {
     //Asserts that a command registry can register the command without throwing an exception
     using (CommandRegistry registry = new CommandRegistry(new RegistrySettings()))
     {
         registry.AddCommand(typeof(TestCommand));
     }
 }
Ejemplo n.º 2
0
        public void TestExecution()
        {
            //Asserts that a command can be run and returns the expected result

            using (CommandRegistry registry = new CommandRegistry(new RegistrySettings()))
            {
                registry.AddCommand(typeof(TestCommand));

                ManualResetEvent mre = new ManualResetEvent(false);

                object testOutput = null;
                registry.HandleInput("unit-test", null, (result, output) => { testOutput = output; mre.Set(); });

                mre.WaitOne();

                Assert.AreEqual(testOutput, CommandOutput);
            }
        }