Ejemplo n.º 1
0
        public AphidRuntimeException CreateRuntimeException01(
            [PexAssumeUnderTest] AphidInterpreter target,
            AphidExpression expression,
            object obj
            )
        {
            AphidRuntimeException result = target.CreateRuntimeException(expression, obj);

            return(result);
            // TODO: add assertions to method AphidInterpreterTest.CreateRuntimeException01(AphidInterpreter, AphidExpression, Object)
        }
Ejemplo n.º 2
0
        public AphidRuntimeException CreateRuntimeException(
            [PexAssumeUnderTest] AphidInterpreter target,
            string message,
            object[] args
            )
        {
            AphidRuntimeException result = target.CreateRuntimeException(message, args);

            return(result);
            // TODO: add assertions to method AphidInterpreterTest.CreateRuntimeException(AphidInterpreter, String, Object[])
        }
Ejemplo n.º 3
0
        public static void StreamWrite(AphidInterpreter interpreter, Stream stream, object buffer)
        {
            byte[] bytes = buffer is List <AphidObject> objects
                ? objects.Select(x => (byte)(decimal)x.Value).ToArray()
                : buffer is string str
                    ? StandardLibrary.Encoding.GetBytes(str)
                    : throw interpreter.CreateRuntimeException(
                                     "Invalid object passed as buffer: {0}",
                                     buffer);

            stream.Write(bytes, 0, bytes.Length);
        }
Ejemplo n.º 4
0
 public static void Kill(AphidInterpreter interpreter, AphidObject process)
 {
     if (process.Value is int)
     {
         Process.GetProcessById((int)process.Value).Kill();
     }
     else if (process.Value is string)
     {
         foreach (var p in Process.GetProcessesByName((string)process.Value))
         {
             p.Kill();
             p.WaitForExit();
         }
     }
     else
     {
         throw interpreter.CreateRuntimeException(
                   "Invalid process id: {0}",
                   process.Value);
     }
 }