示例#1
0
        static object DoTest(string name, long fileSize, TestCallback testCallback, params object[] args)
        {
            long   start;
            long   end;
            long   frequency;
            long   clocks;
            double time;
            double rate;

            QueryPerformanceFrequency(out frequency);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            QueryPerformanceCounter(out start);
            object value = testCallback(args);

            QueryPerformanceCounter(out end);
            GetStats(start, end, frequency, fileSize, out clocks, out time, out rate);

            Console.WriteLine("{0} : {1} ticks, {2:f4} sec., {3:f4} MB/sec.", name.PadRight(25), clocks, time, rate);

            return(value);
        }
示例#2
0
 private void ErrorTemplate(InvokeCallback invoke, TestCallback verify)
 {
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
     {
         mock.DomainClient.Error = new Exception(WebAuthenticationServiceTest.ErrorMessage);
         mock.DomainClient.RequestCallback();
         Assert.IsFalse(mock.DomainClient.CancellationRequested,
                        "Result should not be canceled.");
     },
         verify,
         true);
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
     {
         mock.DomainClient.Error = new Exception(WebAuthenticationServiceTest.ErrorMessage);
         mock.DomainClient.RequestCallback(WebAuthenticationServiceTest.Delay);
         this.EnqueueConditional(() => asyncResult.IsCompleted);
         this.EnqueueCallback(() =>
         {
             Assert.IsFalse(mock.DomainClient.CancellationRequested,
                            "Result should not be canceled.");
         });
     },
         verify,
         false);
     this.EnqueueTestComplete();
 }
示例#3
0
	public static void Main ()
	{
		TestCallback cb = new TestCallback (Test);
		IAsyncResult ar = cb.BeginInvoke (100, null, null);
		ar.AsyncWaitHandle.WaitOne ();
		cb.EndInvoke (ar);
	}
        private void TestTemplate(InvokeCallback invoke, TestCallback proceed, TestCallback verify, bool verifyInCallback)
        {
            AuthenticationDomainContext  mock    = new AuthenticationDomainContext();
            MockWebAuthenticationService service = new MockWebAuthenticationService();

            service.DomainContext = mock;
            object state = new object();

            bool          testCompleted = false;
            AsyncCallback asyncCallback = ar =>
            {
                Assert.IsNotNull(ar,
                                 "IAsyncResult should not be null.");
                Assert.AreEqual(state, ar.AsyncState,
                                "States should be equal.");
                ExceptionHelper.ExpectException <NotSupportedException>(
                    () => Assert.IsNull(ar.AsyncWaitHandle, "This property is not supported."));
                Assert.IsFalse(ar.CompletedSynchronously,
                               "IAsyncResult should not have completed synchronously.");
                Assert.IsTrue(ar.IsCompleted || mock.DomainClient.CancellationRequested,
                              "IAsyncResult should be complete or cancelled.");

                try
                {
                    verify(mock, service, ar);
                }
                catch (Exception ex)
                {
                    this.EnqueueCallback(() => { throw ex; });
                }

                testCompleted = true;
            };

            IAsyncResult asyncResult = invoke(mock, service, verifyInCallback ? asyncCallback : null, state);

            Assert.IsNotNull(asyncResult,
                             "IAsyncResult should not be null.");
            Assert.AreEqual(state, asyncResult.AsyncState,
                            "States should be equal.");
            ExceptionHelper.ExpectException <NotSupportedException>(
                () => Assert.IsNull(asyncResult.AsyncWaitHandle, "This property is not supported."));
            Assert.IsFalse(asyncResult.CompletedSynchronously,
                           "IAsyncResult should not have completed synchronously.");

            // We don't have a dispatcher SynchronizationContext when running tests on the
            // full framework, so the operation will complete on another thread which can happen before we reach this assert
            // TODO: Try to get tests to run on a dispatcher by using mstest v2 extensobility
#if SILVERLIGHT
            Assert.IsFalse(asyncResult.IsCompleted, "IAsyncResult should not be complete.");
#endif

            proceed(mock, service, asyncResult);

            if (!verifyInCallback)
            {
                this.EnqueueCallback(() => asyncCallback(asyncResult));
            }
            this.EnqueueConditional(() => testCompleted);
        }
示例#5
0
 private void CancelTemplate(InvokeCallback invoke, TestCallback proceed, TestCallback verify)
 {
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
     {
         proceed(mock, service, asyncResult);
         mock.DomainClient.RequestCallback();
         Assert.IsTrue(mock.DomainClient.CancellationRequested,
                       "Result should be canceled.");
     },
         verify,
         false);
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
     {
         proceed(mock, service, asyncResult);
         mock.DomainClient.RequestCallback(WebAuthenticationServiceTest.Delay);
         this.EnqueueCallback(() =>
         {
             Assert.IsTrue(mock.DomainClient.CancellationRequested,
                           "Result should be canceled.");
         });
     },
         verify,
         false);
     this.EnqueueTestComplete();
 }
示例#6
0
        static void rdotnet_discussions_646729(REngine engine)
        {
            var setup = @"library(rdotnetsamples)
rdotnetsamples::register_default_progress_handler()
";
            engine.Evaluate(setup);
            var myRFunction = @"
my_r_calculation <- function()
{
  for (i in seq(0, 100, by=20)) {
    rdotnetsamples::broadcast_progress_update(paste0('Some Update Message for ', i), i);
  }
}
";
            engine.Evaluate(myRFunction);
            engine.Evaluate("my_r_calculation()");

            var unixDllPath = engine.Evaluate("getLoadedDLLs()$rdotnetsamples[['path']]").AsCharacter()[0];
            var dllPath = unixDllPath.Replace("/", "\\");
            var dll = new DynamicInterop.UnmanagedDll(dllPath);
            TestCallback cback = new TestCallback();
            CallBackHandlers cbh = new CallBackHandlers();
            cback.MyHandler = cbh.ProcessProgress;

            string cFunctionRegisterCallback = "register_progress_handler";
            register_default_progress_handler registerHandlerFun = dll.GetFunction<register_default_progress_handler>(cFunctionRegisterCallback);
            registerHandlerFun(cback.MyHandler);

            Console.WriteLine();
            Console.WriteLine("After registering the callback with a function pointer to a C# function:");
            Console.WriteLine();
            engine.Evaluate("my_r_calculation()");

        }
示例#7
0
文件: Program.cs 项目: SinaC/TetriNET
        public void TestSpectator()
        {
            TestCallback callback = new TestCallback();

            // Get WCF endpoint
            EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:8765/TetriNETSpectator");

            Binding         binding         = new NetTcpBinding(SecurityMode.None);
            InstanceContext instanceContext = new InstanceContext(callback);
            //_proxy = DuplexChannelFactory<IWCFTetriNET>.CreateChannel(instanceContext, binding, endpointAddress);
            DuplexChannelFactory <IWCFTetriNETSpectator> factory = new DuplexChannelFactory <IWCFTetriNETSpectator>(instanceContext, binding, endpointAddress);
            IWCFTetriNETSpectator proxy = factory.CreateChannel(instanceContext);

            proxy.RegisterSpectator(
                new Versioning
            {
                Major = 1,
                Minor = 5,
            },
                "joel");

            while (true)
            {
                System.Threading.Thread.Sleep(10);
            }
        }
示例#8
0
        /// <summary>
        /// runs one single test without using the reflection mechanisme
        /// The overhead is very low and therefore better suited for small methods
        /// However this method doesn't reports results to connected objects like PerformanceTester
        /// </summary>
        /// <param name="testMethod">method (delegate) to test</param>
        /// <returns>test results</returns>
        public PerformanceTestData RunTest(TestCallback testMethod)
        {
            Counter             counter = Counter.Instance;
            PerformanceTestData td      = new PerformanceTestData();

            td.TestName = testMethod.Method.Name;

            // single invoke
            ulong startCount = counter.Count;

            testMethod();
            ulong endCount = counter.Count;

            td.SingleTime = (uint)Counter.GetElapsed(startCount, endCount);

            // multiple invoke
            startCount = counter.Count;
            for (uint i = 0; i < iterations; i++)
            {
                testMethod();
            }
            endCount       = counter.Count;
            td.OverallTime = (uint)Counter.GetElapsed(startCount, endCount);
            td.TestNum     = (uint)iterations;

            return(td);
        }
示例#9
0
    public static void Main()
    {
        TestCallback cb = new TestCallback(Test);
        IAsyncResult ar = cb.BeginInvoke(100, null, null);

        ar.AsyncWaitHandle.WaitOne();
        cb.EndInvoke(ar);
    }
示例#10
0
        private void TestTemplate(InvokeCallback invoke, TestCallback proceed, TestCallback verify, bool verifyInCallback)
        {
            AuthenticationDomainContext  mock    = new AuthenticationDomainContext();
            MockWebAuthenticationService service = new MockWebAuthenticationService();

            service.DomainContext = mock;
            object state = new object();

            bool          testCompleted = false;
            AsyncCallback asyncCallback = ar =>
            {
                Assert.IsNotNull(ar,
                                 "IAsyncResult should not be null.");
                Assert.AreEqual(state, ar.AsyncState,
                                "States should be equal.");
                ExceptionHelper.ExpectException <NotSupportedException>(
                    () => Assert.IsNull(ar.AsyncWaitHandle, "This property is not supported."));
                Assert.IsFalse(ar.CompletedSynchronously,
                               "IAsyncResult should not have completed synchronously.");
                Assert.IsTrue(ar.IsCompleted || mock.DomainClient.CancellationRequested,
                              "IAsyncResult should be complete or cancelled.");

                verify(mock, service, ar);

                testCompleted = true;
            };

            IAsyncResult asyncResult = invoke(mock, service, verifyInCallback ? asyncCallback : null, state);

            Assert.IsNotNull(asyncResult,
                             "IAsyncResult should not be null.");
            Assert.AreEqual(state, asyncResult.AsyncState,
                            "States should be equal.");
            ExceptionHelper.ExpectException <NotSupportedException>(
                () => Assert.IsNull(asyncResult.AsyncWaitHandle, "This property is not supported."));
            Assert.IsFalse(asyncResult.CompletedSynchronously,
                           "IAsyncResult should not have completed synchronously.");
            Assert.IsFalse(asyncResult.IsCompleted,
                           "IAsyncResult should not be complete.");

            proceed(mock, service, asyncResult);

            if (!verifyInCallback)
            {
                this.EnqueueCallback(() => asyncCallback(asyncResult));
            }

            this.EnqueueConditional(() => testCompleted);
        }
示例#11
0
文件: sample-app.cs 项目: nfan/Jaxer
 public static void Main()
 {
     Interfaces.test myTest = (Interfaces.test)
         Components.CreateInstance("@off.net/test-component;1",
                                   typeof(Interfaces.test));
     Console.WriteLine("3 + 5 = {0}", myTest.Add(3, 5));
     int before = myTest.IntProp;
     myTest.IntProp = 99;
     Console.WriteLine("intProp: {0}, (= 99), {1}", before, myTest.IntProp);
     Console.WriteLine("roIntProp: {0}", myTest.RoIntProp);
     Console.WriteLine("Invoking callback:");
     TestCallback tcb = new TestCallback();
     myTest.Callback(tcb);
     Console.WriteLine("Done!");
 }
        public void ExecutesDelegate()
        {
            Dictionary<string, object> vars = new Dictionary<string, object>();
            vars["concat"] = new TestCallback(Concat);

            FunctionNode fn = new FunctionNode();
            fn.Text = "concat";
            StringLiteralNode str = new StringLiteralNode();
            str.Text = "theValue";
            fn.addChild(str);
            StringLiteralNode str2 = new StringLiteralNode();
            str2.Text = "theValue";
            fn.addChild(str2);

            IExpression exp = fn;
            Assert.AreEqual(string.Format("{0},{1},{2}", this.GetHashCode(), str.Text, str2.Text), exp.GetValue(null, vars));
        }
示例#13
0
        public void ExecutesDelegate()
        {
            Hashtable vars = new Hashtable();
            vars["concat"] = new TestCallback(Concat);

            FunctionNode fn = new FunctionNode();
            fn.Text = "concat";
            StringLiteralNode str = new StringLiteralNode();
            str.Text = "theValue";
            fn.addChild(str);
            StringLiteralNode str2 = new StringLiteralNode();
            str2.Text = "theValue";
            fn.addChild(str2);

            IExpression exp = fn;
            Assert.AreEqual(string.Format("{0},{1},{2}", this.GetHashCode(), str.Text, str2.Text), exp.GetValue(null, vars));
        }
示例#14
0
文件: sample-app.cs 项目: roytam1/fx3
    public static void Main()
    {
        Interfaces.test myTest = (Interfaces.test)
                                 Components.CreateInstance("@off.net/test-component;1",
                                                           typeof(Interfaces.test));
        Console.WriteLine("3 + 5 = {0}", myTest.Add(3, 5));
        int before = myTest.IntProp;

        myTest.IntProp = 99;
        Console.WriteLine("intProp: {0}, (= 99), {1}", before, myTest.IntProp);
        Console.WriteLine("roIntProp: {0}", myTest.RoIntProp);
        Console.WriteLine("Invoking callback:");
        TestCallback tcb = new TestCallback();

        myTest.Callback(tcb);
        Console.WriteLine("Done!");
    }
示例#15
0
        public async Task CallbackExecuted()
        {
            var executor     = Mock.Of <ICallbackExecutor <object> >();
            var executorMock = Mock.Get(executor);
            BindingDelegate <object> parameterBinder = context => { };

            executorMock
            .Setup(_ => _.Execute(It.Is <CallbackExecutionParameters <object> >(o =>
                                                                                o.Parameters.Length == 1 && o.Binder == parameterBinder && o.ResultTargetType == typeof(string)))).Returns(Task.FromResult(new object()));
            executorMock.SetupGet(_ => _.CanExecute).Returns(true);

            var callback = new TestCallback(1, executor, parameterBinder, typeof(string));

            var result = await callback.ExecuteAsync("str");

            Assert.NotNull(result);
        }
示例#16
0
        static bool TestCallback()
        {
            TestCallback testCall = new TestCallback("InteropSample_TestDriver", 12345, 10);

            // Register callback
            NativeEventHandler eventHandler = new NativeEventHandler(testCall.OnNativeEvent);

            testCall.OnInterrupt += eventHandler;

            // Now wait for 10 callbacks
            bool retVal = testCall.TestCallbacks();

            testCall.OnInterrupt -= eventHandler;

            testCall.Dispose();

            return(retVal);
        }
		static void TestSavegameLoad()
		{
			Trace.Write("Trying to load savegame");

			//Initialize pub class object
			Publisher p = new Publisher();
			TestCallback cb = new TestCallback();
			cb.OnStart.Subscribe(TestOnStart);
			cb.OnUpdate.Subscribe(TestOnUpdate);
			cb.OnStop.Subscribe(TestOnStop);

			string filename = @"E:\GitHub\satisfactory-save-repairer-ng\TestBed\NF-Start.sav";
			//string filename = @"C:\Users\SillyBits\AppData\Local\FactoryGame\Saved\SaveGames\testfile2.sav";

			Savegame.Savegame sg = new Savegame.Savegame(filename);

			sg.Load(cb);

			Trace.Write("Finished loading savegame");
		}
		static void TestPubSub()
		{
			//Initialize pub class object
			Publisher p = new Publisher();

			TestCallback cb = new TestCallback();
			TestListener l = new TestListener();

			//cb.OnStart.Subscribe(TestOnStart);
			cb.OnStart.Subscribe((sender, data) => l.TestOnStart(sender, data));
			cb.OnUpdate.Subscribe(l.TestOnUpdate);
			cb.OnStop.Subscribe(l.TestOnStop);

			cb.OnStart.Subscribe(TestOnStart);
			cb.OnUpdate.Subscribe(TestOnUpdate);
			cb.OnStop.Subscribe(TestOnStop);

			//p.Raise(cb.Start, new EventData());
			cb.Start(new TestCallback.StartData());

			// Line below should show an type error
			//cb.Update(new TestCallback.StartData());
		}
示例#19
0
        static void rdotnet_discussions_646729(REngine engine)
        {
            var setup = @"library(rdotnetsamples)
rdotnetsamples::register_default_progress_handler()
";

            engine.Evaluate(setup);
            var myRFunction = @"
my_r_calculation <- function()
{
  for (i in seq(0, 100, by=20)) {
    rdotnetsamples::broadcast_progress_update(paste0('Some Update Message for ', i), i);
  }
}
";

            engine.Evaluate(myRFunction);
            engine.Evaluate("my_r_calculation()");

            var              unixDllPath = engine.Evaluate("getLoadedDLLs()$rdotnetsamples[['path']]").AsCharacter()[0];
            var              dllPath     = unixDllPath.Replace("/", "\\");
            var              dll         = new DynamicInterop.UnmanagedDll(dllPath);
            TestCallback     cback       = new TestCallback();
            CallBackHandlers cbh         = new CallBackHandlers();

            cback.MyHandler = cbh.ProcessProgress;

            string cFunctionRegisterCallback = "register_progress_handler";
            register_default_progress_handler registerHandlerFun = dll.GetFunction <register_default_progress_handler>(cFunctionRegisterCallback);

            registerHandlerFun(cback.MyHandler);

            Console.WriteLine();
            Console.WriteLine("After registering the callback with a function pointer to a C# function:");
            Console.WriteLine();
            engine.Evaluate("my_r_calculation()");
        }
示例#20
0
        static object DoTest(string name, long fileSize, TestCallback testCallback, params object[] args)
        {
            long start;
            long end;
            long frequency;
            long clocks;
            double time;
            double rate;

            QueryPerformanceFrequency(out frequency);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            QueryPerformanceCounter(out start);
            object value = testCallback(args);
            QueryPerformanceCounter(out end);
            GetStats(start, end, frequency, fileSize, out clocks, out time, out rate);

            Console.WriteLine("{0} : {1} ticks, {2:f4} sec., {3:f4} MB/sec.", name.PadRight(25), clocks, time, rate);

            return value;
        }
示例#21
0
 public void SetTimer(TestCallback Callback, int time)
 {
     isStart = true;
 }
 private void ErrorTemplate(InvokeCallback invoke, TestCallback verify)
 {
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
         {
             mock.DomainClient.Error = new Exception(WebAuthenticationServiceTest.ErrorMessage);
             mock.DomainClient.RequestCallback();
             Assert.IsFalse(mock.DomainClient.CancellationRequested,
                 "Result should not be canceled.");
         },
         verify,
         true);
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
         {
             mock.DomainClient.Error = new Exception(WebAuthenticationServiceTest.ErrorMessage);
             mock.DomainClient.RequestCallback(WebAuthenticationServiceTest.Delay);
             this.EnqueueConditional(() => asyncResult.IsCompleted);
             this.EnqueueCallback(() =>
             {
                 Assert.IsFalse(mock.DomainClient.CancellationRequested,
                     "Result should not be canceled.");
             });
         },
         verify,
         false);
     this.EnqueueTestComplete();
 }
示例#23
0
 public void Hoge(TestCallback Callback, string s)
 {
     Callback(s, totalTime);
 }
示例#24
0
		public TestRunItem (string url, TestCallback callback)
		: this (url, null, callback)
		{}
示例#25
0
		public TestRunItem (string url, string urlDescription, TestCallback callback)
		{
			Url = url;
			Callback = callback;
			UrlDescription = urlDescription;
		}
			public string TestClientCallback(string name, TestCallback callback)
			{
				return callback.SayHello(name);
			}
示例#27
0
   public override void HandleMouseUp(System.Windows.Forms.MouseEventArgs e, TreeNode tn)
   {
      if (this.Layout == null || this.Layout.TreeView == null)
         return;

      IMaxNode node = TreeMode.GetMaxNode(tn);
      if (node == null)
         return;

      IEnumerable<IMaxNode> contextNodes = TreeMode.GetMaxNodes(this.GetContextNodes(tn));

      IntPtr hwnd = MaxInterfaces.MaxHwnd.Handle;
      Color nodeColor = GetNodeColor(node);
      IAColor initColor = MaxInterfaces.Global.AColor.Create(nodeColor.R / 255f, nodeColor.G / 255f, nodeColor.B / 255f, nodeColor.A / 255f);
      IIPoint2 initPos = MaxInterfaces.Global.IPoint2NS.Create(200, 200);
      IHSVCallback colorPickerCallback = new TestCallback(contextNodes, initColor, PreviewNodeColor, CommitNodeColor);
      IColorPicker colorPicker = MaxInterfaces.Global.CreateColorPicker(hwnd, initColor, initPos, colorPickerCallback, "Test", 0);

      //Color color = GetNodeColor(node);
      //IInterface ip = MaxInterfaces.Global.COREInterface;
      //if (ip.NodeColorPicker(ip.MAXHWnd, ref color))
      //{
      //   TreeView tree = this.Layout.TreeView;
      //   IEnumerable<TreeNode> nodes = null;
      //   if (tn.IsSelected && !ControlHelpers.ControlPressed)
      //      nodes = tree.SelectedNodes;
      //   else
      //      nodes = new List<TreeNode>(1) { tn };

      //   IEnumerable<IMaxNode> maxNodes = TreeMode.GetMaxNodes(nodes);
      //   SetNodeColor(maxNodes, Colors.FromMaxColor(color));

      //   //if (tree.NodeSorter is NodePropertySorter &&
      //   //   ((NodePropertySorter)tree.NodeSorter).Property == this.Property)
      //   //{
      //   //   tree.StartTimedSort(nodes);
      //   //}
      //}
   }
示例#28
0
 public void TestLogin(TestCallback callback)
 {
     GetResponse("rtm.test.login", false, (response) =>
     {
         if (response.Status == ResponseStatus.OK)
         {
             callback(true);
         }
         else
         {
             if (response.Error.Code == ErrorCode.UserNotLoggedInOrInsufficientPermissions)
                 callback(false);
             else
                 throw new RtmException(response.Error);
         }
     });
 }
 public TestRunItem(string url, TestCallback callback)
     : this(url, null, callback)
 {
 }
 public TestRunItem(string url, string urlDescription, TestCallback callback)
 {
     Url            = url;
     Callback       = callback;
     UrlDescription = urlDescription;
 }
 private void CancelTemplate(InvokeCallback invoke, TestCallback proceed, TestCallback verify)
 {
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
         {
             proceed(mock, service, asyncResult);
             mock.DomainClient.RequestCallback();
             Assert.IsTrue(mock.DomainClient.CancellationRequested,
                 "Result should be canceled.");
         },
         verify,
         false);
     this.TestTemplate(
         invoke,
         (mock, service, asyncResult) =>
         {
             proceed(mock, service, asyncResult);
             mock.DomainClient.RequestCallback(WebAuthenticationServiceTest.Delay);
             this.EnqueueCallback(() =>
             {
                 Assert.IsTrue(mock.DomainClient.CancellationRequested,
                     "Result should be canceled.");
             });
         },
         verify,
         false);
     this.EnqueueTestComplete();
 }
示例#32
0
 public void Timer(TestCallback Callback)
 {
 }
        private void TestTemplate(InvokeCallback invoke, TestCallback proceed, TestCallback verify, bool verifyInCallback)
        {
            AuthenticationDomainContext mock = new AuthenticationDomainContext();
            MockWebAuthenticationService service = new MockWebAuthenticationService() ;
            service.DomainContext = mock;
            object state = new object();
            
            bool testCompleted = false;
            AsyncCallback asyncCallback = ar =>
            {
                Assert.IsNotNull(ar,
                    "IAsyncResult should not be null.");
                Assert.AreEqual(state, ar.AsyncState,
                    "States should be equal.");
                ExceptionHelper.ExpectException<NotSupportedException>(
                    () => Assert.IsNull(ar.AsyncWaitHandle, "This property is not supported."));
                Assert.IsFalse(ar.CompletedSynchronously,
                    "IAsyncResult should not have completed synchronously.");
                Assert.IsTrue(ar.IsCompleted || mock.DomainClient.CancellationRequested,
                    "IAsyncResult should be complete or cancelled.");

                verify(mock, service, ar);

                testCompleted = true;
            };

            IAsyncResult asyncResult = invoke(mock, service, verifyInCallback ? asyncCallback : null, state);

            Assert.IsNotNull(asyncResult,
                "IAsyncResult should not be null.");
            Assert.AreEqual(state, asyncResult.AsyncState,
                "States should be equal.");
            ExceptionHelper.ExpectException<NotSupportedException>(
                () => Assert.IsNull(asyncResult.AsyncWaitHandle, "This property is not supported."));
            Assert.IsFalse(asyncResult.CompletedSynchronously,
                "IAsyncResult should not have completed synchronously.");
            Assert.IsFalse(asyncResult.IsCompleted,
                "IAsyncResult should not be complete.");

            proceed(mock, service, asyncResult);

            if (!verifyInCallback)
            {
                this.EnqueueCallback(() => asyncCallback(asyncResult));
            }

            this.EnqueueConditional(() => testCompleted);
        }