コード例 #1
0
            public WeakFunc<string> GetFunc(WeakActionTestCase testCase)
            {
                WeakFunc<string> action = null;

                switch (testCase)
                {
                    case WeakActionTestCase.PublicNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPublicallyWithResult);
                        break;
                    case WeakActionTestCase.InternalNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffInternallyWithResult);
                        break;
                    case WeakActionTestCase.PrivateNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPrivatelyWithResult);
                        break;
                    case WeakActionTestCase.PublicStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPublicallyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.InternalStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffInternallyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.PrivateStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPrivatelyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.AnonymousStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            () =>
                            {
                                Result = Expected;
                                return Result;
                            });
                        break;
                    case WeakActionTestCase.AnonymousMethod:
                        action = new WeakFunc<string>(
                            this,
                            () =>
                            {
                                Result = Expected + _index;
                                return Result;
                            });
                        break;
                }

                return action;
            }
コード例 #2
0
        public WeakAction <T> GetAction(WeakActionTestCase testCase)
        {
            WeakAction <T> action = null;

            switch (testCase)
            {
            case WeakActionTestCase.PublicNamedMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffPublically);
                break;

            case WeakActionTestCase.InternalNamedMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffInternally);
                break;

            case WeakActionTestCase.PrivateNamedMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffPrivately);
                break;

            case WeakActionTestCase.PublicStaticMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffPublicallyAndStatically);
                break;

            case WeakActionTestCase.InternalStaticMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffInternallyAndStatically);
                break;

            case WeakActionTestCase.PrivateStaticMethod:
                action = new WeakAction <T>(
                    this,
                    DoStuffPrivatelyAndStatically);
                break;

            case WeakActionTestCase.AnonymousStaticMethod:
                action = new WeakAction <T>(
                    this,
                    p => Result = Expected + p);
                break;

            case WeakActionTestCase.AnonymousMethod:
                action = new WeakAction <T>(
                    this,
                    p => Result = Expected + _index + p);
                break;
            }

            return(action);
        }
コード例 #3
0
            public TestRecipientInternal(WeakActionTestCase testCase)
            {
                switch (testCase)
                {
                case WeakActionTestCase.PublicNamedMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuff);
                    break;

                case WeakActionTestCase.PrivateNamedMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuffPrivate);
                    break;

                case WeakActionTestCase.InternalNamedMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuffInternal);
                    break;

                case WeakActionTestCase.PublicStaticMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuffStatic);
                    break;

                case WeakActionTestCase.PrivateStaticMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuffPrivateStatic);
                    break;

                case WeakActionTestCase.InternalStaticMethod:
                    Messenger.Default.Register <string>(
                        this,
                        DoStuffInternalStatic);
                    break;

                case WeakActionTestCase.AnonymousMethod:
                    Messenger.Default.Register <string>(
                        this,
                        msg => Content = msg);
                    break;

                case WeakActionTestCase.AnonymousStaticMethod:
                    Messenger.Default.Register <string>(
                        this,
                        msg => ContentStatic = msg);
                    break;
                }
            }
コード例 #4
0
ファイル: PublicTestClass.cs プロジェクト: jprofi/MSProjects
        public WeakAction GetAction(WeakActionTestCase testCase)
        {
            WeakAction action = null;

            switch (testCase)
            {
                case WeakActionTestCase.PublicNamedMethod:
                    action = new WeakAction(
                        this,
                        DoStuffPublically);
                    break;
                case WeakActionTestCase.InternalNamedMethod:
                    action = new WeakAction(
                        this,
                        DoStuffInternally);
                    break;
                case WeakActionTestCase.PrivateNamedMethod:
                    action = new WeakAction(
                        this,
                        DoStuffPrivately);
                    break;
                case WeakActionTestCase.PublicStaticMethod:
                    action = new WeakAction(
                        this,
                        DoStuffPublicallyAndStatically);
                    break;
                case WeakActionTestCase.InternalStaticMethod:
                    action = new WeakAction(
                        this,
                        DoStuffInternallyAndStatically);
                    break;
                case WeakActionTestCase.PrivateStaticMethod:
                    action = new WeakAction(
                        this,
                        DoStuffPrivatelyAndStatically);
                    break;
                case WeakActionTestCase.AnonymousStaticMethod:
                    action = new WeakAction(
                        this,
                        () => Result = Expected);
                    break;
                case WeakActionTestCase.AnonymousMethod:
                    action = new WeakAction(
                        this,
                        () => Result = Expected + _index);
                    break;
            }

            return action;
        }
コード例 #5
0
        public PublicTestClassWithResult(WeakActionTestCase testCase)
        {
            switch (testCase)
            {
            case WeakActionTestCase.PublicNamedMethod:
                Func = new WeakFunc <string>(
                    this,
                    DoStuffPublically);
                break;

            case WeakActionTestCase.PrivateNamedMethod:
                Func = new WeakFunc <string>(
                    this,
                    DoStuffPrivately);
                break;

            case WeakActionTestCase.PublicStaticMethod:
                Func = new WeakFunc <string>(
                    this,
                    DoStuffPublicallyAndStatically);
                break;

            case WeakActionTestCase.PrivateStaticMethod:
                Func = new WeakFunc <string>(
                    this,
                    DoStuffPrivatelyAndStatically);
                break;

            case WeakActionTestCase.AnonymousStaticMethod:
                Func = new WeakFunc <string>(
                    this,
                    () =>
                {
                    Result = Expected;
                    return(Result);
                });
                break;

            case WeakActionTestCase.AnonymousMethod:
                Func = new WeakFunc <string>(
                    this,
                    () =>
                {
                    Result = Expected + _index;
                    return(Result);
                });
                break;
            }
        }
コード例 #6
0
        public PublicTestClassWithResult(WeakActionTestCase testCase)
        {
            switch (testCase)
            {
                case WeakActionTestCase.PublicNamedMethod:
                    Func = new WeakFunc<string>(
                        this,
                        DoStuffPublically);
                    break;
                case WeakActionTestCase.PrivateNamedMethod:
                    Func = new WeakFunc<string>(
                        this,
                        DoStuffPrivately);
                    break;
                case WeakActionTestCase.PublicStaticMethod:
                    Func = new WeakFunc<string>(
                        this,
                        DoStuffPublicallyAndStatically);
                    break;
                case WeakActionTestCase.PrivateStaticMethod:
                    Func = new WeakFunc<string>(
                        this,
                        DoStuffPrivatelyAndStatically);
                    break;
                case WeakActionTestCase.AnonymousStaticMethod:
                    Func = new WeakFunc<string>(
                        this,
                        () =>
                        {
                            Result = Expected;
                            return Result;
                        });
                    break;
                case WeakActionTestCase.AnonymousMethod:
                    Func = new WeakFunc<string>(
                        this,
                        () =>
                        {
                            Result = Expected + _index;
                            return Result;
                        });
                    break;
            }

        }
        public InternalTestClassWithResult(WeakActionTestCase testCase, T parameter)
        {
            _parameter = parameter;

            switch (testCase)
            {
            case WeakActionTestCase.PublicNamedMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    DoStuffPublically);
                break;

            case WeakActionTestCase.PrivateNamedMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    DoStuffPrivately);
                break;

            case WeakActionTestCase.PublicStaticMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    DoStuffPublicallyAndStatically);
                break;

            case WeakActionTestCase.PrivateStaticMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    DoStuffPrivatelyAndStatically);
                break;

            case WeakActionTestCase.AnonymousStaticMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    p => Result = Expected + p);
                break;

            case WeakActionTestCase.AnonymousMethod:
                Func = new WeakFunc <T, string>(
                    this,
                    p => Result = Expected + _index + p);
                break;
            }
        }
コード例 #8
0
            public WeakFunc<string> GetFunc(WeakActionTestCase testCase)
            {
                WeakFunc<string> action = null;

                switch (testCase)
                {
                    case WeakActionTestCase.PublicNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPublicallyWithResult);
                        break;
                    case WeakActionTestCase.InternalNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffInternallyWithResult);
                        break;
                    case WeakActionTestCase.PrivateNamedMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPrivatelyWithResult);
                        break;
                    case WeakActionTestCase.PublicStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPublicallyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.InternalStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffInternallyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.PrivateStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            DoStuffPrivatelyAndStaticallyWithResult);
                        break;
                    case WeakActionTestCase.AnonymousStaticMethod:
                        action = new WeakFunc<string>(
                            this,
                            () =>
                                {
                                    Result = Expected;
                                    return Result;
                                });
                        break;
                    case WeakActionTestCase.AnonymousMethod:
                        action = new WeakFunc<string>(
                            this,
                            () =>
                                {
                                    Result = Expected + _index;
                                    return Result;
                                });
                        break;
                }

                return action;
            }
コード例 #9
0
 public TestRecipientPrivate(WeakActionTestCase testCase)
 {
     switch (testCase)
     {
         case WeakActionTestCase.PublicNamedMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuff);
             break;
         case WeakActionTestCase.PrivateNamedMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuffPrivate);
             break;
         case WeakActionTestCase.InternalNamedMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuffInternal);
             break;
         case WeakActionTestCase.PublicStaticMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuffStatic);
             break;
         case WeakActionTestCase.PrivateStaticMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuffPrivateStatic);
             break;
         case WeakActionTestCase.InternalStaticMethod:
             Messenger.Default.Register<string>(
                 this,
                 DoStuffInternalStatic);
             break;
         case WeakActionTestCase.AnonymousMethod:
             Messenger.Default.Register<string>(
                 this,
                 msg => Content = msg);
             break;
         case WeakActionTestCase.AnonymousStaticMethod:
             Messenger.Default.Register<string>(
                 this,
                 msg => ContentStatic = msg);
             break;
     }
 }
コード例 #10
0
 public InternalTestClassWithResult(WeakActionTestCase testCase, int index, T parameter)
     : this(testCase, parameter)
 {
     _index = index;
 }
コード例 #11
0
 public PublicTestClassWithResult(WeakActionTestCase testCase, int index)
     : this(testCase)
 {
     _index = index;
 }
コード例 #12
0
 public PublicTestClassWithResult(WeakActionTestCase testCase, int index)
     : this(testCase)
 {
     _index = index;
 }