示例#1
0
        public void should_get_delegate_method_C_by_id_from_registry()
        {
            var @delegate = DelegateRegistry <Func <short, short, short> > .TryGetValue(GuidHashCode(TestClass.GUID));

            Assert.IsNotNull(@delegate);
            Assert.Throws <NotImplementedException>(() => @delegate(0, 0));
        }
示例#2
0
        public void should_get_delegate_method_A_by_id_from_registry()
        {
            var @delegate = DelegateRegistry <Func <int, int, int> > .TryGetValue(GuidHashCode(TestClass.GUID));

            Assert.IsNotNull(@delegate);
            Assert.AreEqual(3, @delegate(1, 2));
        }
示例#3
0
        public void should_log_error_while_fetching_delegate_method_B_by_id_from_registry()
        {
            DelegateRegistry <Func <int, int, double> > .TryGetValue(GuidHashCode(TestClass.GUID));

            if (_isFirstRun)
            {
                LogAssert.Expect(LogType.Error, new Regex("Cannot create delegate .*"));
            }
            FirstRun.Init();
        }
示例#4
0
            public static R Call <R>() where R : unmanaged
            {
                var id        = GuidHashCode(TestClass.GUID);
                var @delegate = DelegateRegistry <Func <T, U, R> > .TryGetValue(id);

                return(@delegate?.Invoke(default, default) ?? default);