Example #1
0
        private string Decompile(ICommand command)
        {
            StringWriter writer     = new StringWriter();
            IVisitor     decompiler = new DecompileVisitor(writer);

            command.Accept(decompiler);

            writer.Close();

            return(writer.ToString());
        }
        private T DecodeAndAssertMessageType <T>(ICommand c) where T : MessageArgsBase
        {
            // Use a timeout to avoid tests from hanging indefinitely if there isn't a message.
            var task = _decoder.ObserveMessage.FirstAsync().Timeout(Timeout).ToTask();

            c.Accept(_decoder);
            var message = task.Result;

            // We could also do the conversion in the observable, but doing it here
            // makes failures a bit more obvious.
            return(Assert.IsAssignableFrom <T>(message));
        }
Example #3
0
 public static bool Apply(this IScheduler source, IContext context, ICommand command)
 {
     command = command.Accept(source.Acceptable) ? command : null;
     command?.Execute(context);
     return(command != null);
 }