Inheritance: IFileSyncContext, IDisposable
        public static IFileSyncContext InitializeFileSyncContext(this IMobileServiceClient client, IFileSyncHandler syncHandler, IMobileServiceLocalStore store)
        {
            lock (contextsSyncRoot)
            {
                IFileSyncContext context;

                if (!contexts.TryGetValue(client, out context))
                {
                    context = new MobileServiceFileSyncContext(client, new FileMetadataStore(store), new FileOperationQueue(store), syncHandler);
                    contexts.Add(client, context);
                }

                return context;
            }
        }
Ejemplo n.º 2
0
        public static IFileSyncContext InitializeFileSyncContext(this IMobileServiceClient client, IFileSyncHandler syncHandler,
                                                                 IMobileServiceLocalStore store, IFileSyncTriggerFactory fileSyncTriggerFactory)
        {
            lock (contextsSyncRoot)
            {
                IFileSyncContext context;

                if (!contexts.TryGetValue(client, out context))
                {
                    context = new MobileServiceFileSyncContext(client, new FileMetadataStore(store), new FileOperationQueue(store), fileSyncTriggerFactory, syncHandler);
                    contexts.Add(client, context);
                }

                return(context);
            }
        }
        public MobileServiceFileSyncContextScenario()
        {
            this.mobileServiceClientMock = new Mock<IMobileServiceClient>();
            this.triggerFactory = new Mock<IFileSyncTriggerFactory>();

            SyncHandlerMock = new Mock<IFileSyncHandler>();
            FileMetadataStoreMock = new Mock<IFileMetadataStore>();
            FileOperationQueueMock = new Mock<IFileOperationQueue>();
            FilesClientMock = new Mock<IMobileServiceFilesClient>();

            EventManagerMock = new Mock<IMobileServiceEventManager>();
            
            this.mobileServiceClientMock.Setup(m => m.EventManager)
                .Returns(EventManagerMock.Object);

            SyncContext = new MobileServiceFileSyncContext(mobileServiceClientMock.Object, FileMetadataStoreMock.Object,
                FileOperationQueueMock.Object, triggerFactory.Object, SyncHandlerMock.Object, FilesClientMock.Object);
        }