예제 #1
0
        public void TestFetchRemoteChanges()
        {
            using (var f = _testHelper.GetFileSystem())
            {
                Action finished = () => { };
                Action<long, long> progrssChanged = (i, j) => { };

                f.FileSystemOptions.Id = 33;

                var m = new DiskServiceMock();

                using (var s = new SynchronizationServiceMock(f, new UserDto(), new SynchronizationCallbacks(finished, progrssChanged), m))
                {
                    m.SynchronizationState = SynchronizationState.LocalChanges;
                    Assert.AreEqual(m.SynchronizationState, s.FetchSynchronizationState());

                    m.SynchronizationState = SynchronizationState.RemoteChanges;
                    Assert.AreEqual(m.SynchronizationState, s.FetchSynchronizationState());

                    m.SynchronizationState = SynchronizationState.UpToDate;
                    Assert.AreEqual(m.SynchronizationState, s.FetchSynchronizationState());

                    m.SynchronizationState = SynchronizationState.Conflicted;
                    Assert.AreEqual(m.SynchronizationState, s.FetchSynchronizationState());
                }
            }
        }
예제 #2
0
        public void TestSynchronizeWhenConflicted()
        {
            using (var f = _testHelper.GetFileSystem())
            {
                Action finished = () => { };
                Action<long, long> progrssChanged = (i, j) => { };

                var m = new DiskServiceMock
                {
                    DiskFake = new DiskDto { Id = 33 },
                    SynchronizationState = SynchronizationState.Conflicted,
                    DiskOptionsMock = new DiskOptionsDto
                    {
                        SerializedFileSystemOptions = SynchronizationHelper.CalculateDiskOptions(f.FileSystemOptions).SerializedFileSystemOptions
                    }
                };
                using (var s = new SynchronizationServiceMock(f, new UserDto(), new SynchronizationCallbacks(finished, progrssChanged), m))
                {
                    s.Synchronize();
                }
            }
        }