public async Task Sync_LoadTest_TwoWay_String()
        {
            CreateRandomStringLists(out var sourceItems, out var destinationItems);

            await CreateSyncAgent(sourceItems, destinationItems)
            .Configure((c) => c.SyncMode.SyncModePreset = SyncModePreset.TwoWay)
            .SyncAsync(CancellationToken.None).ConfigureAwait(false);

            AssertionHelper.VerifySortedSetsAreEquivalent(sourceItems, destinationItems);
        }
Пример #2
0
        public async Task Sync_LoadTest_MirrorToSource_String()
        {
            CreateRandomStringLists(out var sourceItems, out var destinationItems);

            SortedSet <string> expectedSourceList = new SortedSet <string>(destinationItems)
            , expectedDestinationList             = new SortedSet <string>(destinationItems);

            await CreateSyncAgent(sourceItems, destinationItems)
            .Configure((c) => c.SyncMode.SyncModePreset = SyncModePreset.MirrorToSource)
            .SyncAsync(CancellationToken.None).ConfigureAwait(false);

            AssertionHelper.VerifySortedSetsAreEquivalent(sourceItems, expectedSourceList);
            AssertionHelper.VerifySortedSetsAreEquivalent(destinationItems, expectedDestinationList);
        }
        public async Task Sync_Custom_NewerMatches_UpdateDestination_Class_NonEmptySortedSets()
        {
            SortedSet <Event> source = CreateSourceEventSortedSet(), destination = CreateDestinationEventSortedSet();

            await CreateSyncAgent()
            .SetSourceProvider(source)
            .SetDestinationProvider(destination)
            .Configure((c) => c.SyncMode.NewerMatches = SyncMatchOperation.UpdateDestination)
            .SyncAsync(CancellationToken.None).ConfigureAwait(false);

            var expectedSourceList      = CreateSourceEventSortedSet();
            var expectedDestinationList = CreateDestinationEventSortedSet();

            expectedDestinationList.RemoveWhere(x => new int?[] { 1, 4 }.Contains(x.Id));
            expectedSourceList.Where(x => new int?[] { 1, 4 }.Contains(x.Id))
            .ToList().ForEach(x => expectedDestinationList.Add(x));


            AssertionHelper.VerifySortedSetsAreEquivalent(source, expectedSourceList);
            AssertionHelper.VerifySortedSetsAreEquivalent(destination, expectedDestinationList);
        }