コード例 #1
0
        private static IServiceProviders GetServiceProvidersMock()
        {
            IServiceProviders serviceProviders = Substitute.For <IServiceProviders>();

            ITheGraph theGraph = Substitute.For <ITheGraph>();

            serviceProviders.theGraph.Returns(theGraph);

            return(serviceProviders);
        }
コード例 #2
0
ファイル: PlatformContext.cs プロジェクト: endel/explorer
 public PlatformContext(IMemoryManager memoryManager,
                        ICullingController cullingController,
                        IClipboard clipboard,
                        IPhysicsSyncController physicsSyncController,
                        IParcelScenesCleaner parcelScenesCleaner,
                        IDebugController debugController,
                        IWebRequestController webRequest,
                        IServiceProviders serviceProviders)
 {
     this.memoryManager         = memoryManager;
     this.cullingController     = cullingController;
     this.clipboard             = clipboard;
     this.physicsSyncController = physicsSyncController;
     this.parcelScenesCleaner   = parcelScenesCleaner;
     this.debugController       = debugController;
     this.webRequest            = webRequest;
     this.serviceProviders      = serviceProviders;
 }
コード例 #3
0
 public static PlatformContext CreateWithCustomMocks(
     IMemoryManager memoryManager         = null,
     ICullingController cullingController = null,
     IClipboard clipboard = null,
     IPhysicsSyncController physicsSyncController = null,
     IParcelScenesCleaner parcelScenesCleaner     = null,
     IDebugController debugController             = null,
     IWebRequestController webRequestController   = null,
     IServiceProviders serviceProviders           = null)
 {
     return(new PlatformContext(
                memoryManager: memoryManager ?? Substitute.For <IMemoryManager>(),
                cullingController: cullingController ?? Substitute.For <ICullingController>(),
                clipboard: clipboard ?? Substitute.For <IClipboard>(),
                physicsSyncController: physicsSyncController ?? Substitute.For <IPhysicsSyncController>(),
                parcelScenesCleaner: parcelScenesCleaner ?? Substitute.For <ParcelScenesCleaner>(),
                debugController: debugController ?? Substitute.For <IDebugController>(),
                webRequest: webRequestController ?? GetWebRequestControllerMock(),
                serviceProviders: serviceProviders ?? GetServiceProvidersMock()));
 }
コード例 #4
0
        public static PlatformContext CreateWithGenericMocks(params object[] mocks)
        {
            IMemoryManager         memoryManager         = Substitute.For <IMemoryManager>();
            ICullingController     cullingController     = Substitute.For <ICullingController>();
            IParcelScenesCleaner   parcelScenesCleaner   = Substitute.For <IParcelScenesCleaner>();
            IClipboard             clipboard             = Substitute.For <IClipboard>();
            IPhysicsSyncController physicsSyncController = Substitute.For <IPhysicsSyncController>();
            IDebugController       debugController       = Substitute.For <IDebugController>();
            IWebRequestController  webRequest            = Substitute.For <IWebRequestController>();
            IServiceProviders      serviceProviders      = Substitute.For <IServiceProviders>();
            IIdleChecker           idleChecker           = Substitute.For <IIdleChecker>();
            IAvatarsLODController  avatarsLODController  = Substitute.For <IAvatarsLODController>();

            foreach (var mock in mocks)
            {
                switch (mock)
                {
                case ICullingController cc:
                    cullingController = cc;
                    break;

                case IMemoryManager mm:
                    memoryManager = mm;
                    break;

                case IClipboard c:
                    clipboard = c;
                    break;

                case IPhysicsSyncController psc:
                    physicsSyncController = psc;
                    break;

                case IParcelScenesCleaner pscc:
                    parcelScenesCleaner = pscc;
                    break;

                case IDebugController dc:
                    debugController = dc;
                    break;

                case IWebRequestController wrc:
                    webRequest = wrc;
                    break;

                case IServiceProviders sp:
                    serviceProviders = sp;
                    break;

                case IIdleChecker idl:
                    idleChecker = idl;
                    break;

                case IAvatarsLODController alodc:
                    avatarsLODController = alodc;
                    break;
                }
            }

            return(new PlatformContext(memoryManager,
                                       cullingController,
                                       clipboard,
                                       physicsSyncController,
                                       parcelScenesCleaner,
                                       debugController,
                                       webRequest,
                                       serviceProviders,
                                       idleChecker,
                                       avatarsLODController));
        }