Exemplo n.º 1
0
        private static ReactContext CreateReactContext(IInvocationHandler handler)
        {
            var context  = new ReactContext();
            var jsTimers = new JSTimersExecution
            {
                InvocationHandler = handler,
            };

            var reactInstance = new TestReactInstance(jsTimers);

            context.InitializeWithInstance(reactInstance);
            return(context);
        }
Exemplo n.º 2
0
        public void JSTimersExecution_Invoke()
        {
            var module = new JSTimersExecution();

            var name = default(string);
            var args = default(object[]);

            module.InvocationHandler = new MockInvocationHandler((n, a) =>
            {
                name = n;
                args = a;
            });

            var ids = new[] { 42 };

            module.callTimers(ids);
            Assert.AreEqual(nameof(JSTimersExecution.callTimers), name);
            Assert.AreEqual(1, args.Length);
            Assert.AreSame(ids, args[0]);
        }
Exemplo n.º 3
0
 public TestReactInstance(JSTimersExecution jsTimers)
     : base()
 {
     _jsTimers = jsTimers;
 }