public void ProcessWorkerWithIntParameterTest()
        {
            const int i1    = 1337;
            var       data0 = ProcessWorker.RunAndWait(RemoteExecuteInt1, i1);

            Assert.AreEqual(i1 * 2, data0);
        }
 public void ProcessWorkerThrowingExceptionInIntMethod()
 {
     Assert.Throws <ProcessWorkerRemoteException>(() =>
     {
         ProcessWorker.RunAndWait(IntMethodWhichThrows);
     });
 }
 public void PassEnumValueTwo()
 {
     Assert.DoesNotThrow(() =>
     {
         ProcessWorker.RunAndWait(AssertGivenEnumValue, TestTheEnums.TestValueOne);
     });
 }
 public void PassEnumValueOne()
 {
     Assert.Throws <ProcessWorkerRemoteException>(() =>
     {
         ProcessWorker.RunAndWait(AssertGivenEnumValue, TestTheEnums.TestValueTwo);
     });
 }
        public void ProcessWorkerRemoteAssertion()
        {
            var result = ProcessWorker.RunAndWait(RemoteAssertion, 42);

            Assert.AreEqual(42, result);

            Assert.Throws <ProcessWorkerRemoteException>(() => ProcessWorker.RunAndWait(RemoteAssertion, 32));
        }
        public void ConverterTest()
        {
            var enumResult = ProcessWorker.RunAndWait(RemoteEnum);

            Assert.AreEqual(TestEnum.Leet, enumResult);

            var intResult = ProcessWorker.RunAndWait(RemoteInt);

            Assert.AreEqual(12345, intResult);
        }
        public void ProcessWorkerWithParametersOkTest()
        {
            const string p1    = "1";
            var          data1 = ProcessWorker.RunAndWait(RemoteExeute1, p1);

            Assert.AreEqual(TestData + p1, data1);

            const string p2    = "2";
            var          data2 = ProcessWorker.RunAndWait(RemoteExeute2, p1, p2);

            Assert.AreEqual(TestData + p1 + p2, data2);

            const string p3    = "3";
            var          data3 = ProcessWorker.RunAndWait(RemoteExeute3, p1, p2, p3);

            Assert.AreEqual(TestData + p1 + p2 + p3, data3);

            const string p4    = "4";
            var          data4 = ProcessWorker.RunAndWait(RemoteExeute4, p1, p2, p3, p4);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4, data4);

            const string p5    = "5";
            var          data5 = ProcessWorker.RunAndWait(RemoteExeute5, p1, p2, p3, p4, p5);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5, data5);

            const string p6    = "6";
            var          data6 = ProcessWorker.RunAndWait(RemoteExeute6, p1, p2, p3, p4, p5, p6);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5 + p6, data6);

            const string p7    = "7";
            var          data7 = ProcessWorker.RunAndWait(RemoteExeute7, p1, p2, p3, p4, p5, p6, p7);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5 + p6 + p7, data7);

            const string p8    = "8";
            var          data8 = ProcessWorker.RunAndWait(RemoteExeute8, p1, p2, p3, p4, p5, p6, p7, p8);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8, data8);

            const string p9    = "9";
            var          data9 = ProcessWorker.RunAndWait(RemoteExeute9, p1, p2, p3, p4, p5, p6, p7, p8, p9);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9, data9);

            const string p10    = "A";
            var          data10 = ProcessWorker.RunAndWait(RemoteExeute10, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);

            Assert.AreEqual(TestData + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10, data10);
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Start MultiProcessWorkerClient Demo");

            using (var processWorker = ProcessWorker.Create())
            {
                var resultGuid = processWorker.Execute(ExecuteThisNow);

                Console.WriteLine("key to send");
                Console.ReadKey();

                var result = processWorker.ExecuteWait(ExecuteMeNow);

                Console.WriteLine(result);

                Console.WriteLine("key to send");
                Console.ReadKey();

                if (processWorker.IsDataReady(resultGuid))
                {
                    var result2 = processWorker.GetResult <string>(resultGuid);
                    Console.WriteLine(result2);
                }

                Console.WriteLine("key to exit");
                Console.ReadKey();
            }

            try
            {
                ProcessWorker.RunAndWait(ExecuteFuckedUp);
            }
            catch (ProcessWorkerRemoteException e)
            {
                Console.WriteLine(e);
            }
        }
 public void ProcessWorkerRemoteExceptionTest()
 {
     Assert.Throws <ProcessWorkerRemoteException>(() => ProcessWorker.RunAndWait(RemoteExceptionExecute));
 }
 public void ProcessWorkerFailTest()
 {
     Assert.Throws <ArgumentException>(() => ProcessWorker.RunAndWait(RemoteFailExecute));
 }
        public void ProcessWorkerOkTest()
        {
            var data = ProcessWorker.RunAndWait(RemoteExecute);

            Assert.AreEqual(TestData, data);
        }
 public void ProcessWorkerWithReturnTest()
 {
     ProcessWorker.RunAndWait(RemoteExecuteNoReturn, 1000);
 }