public void Sync_Class_SourceProviderIsNotSet() { Func <Task> act = async() => await BatchSyncAgent <int?, Event> .Create() .SetComparerAgent(KeyComparerAgent <int?> .Create()) .SetKeySelector(x => x.Id) .SetCompareItemFunc((s, d) => MatchComparisonResultType.Conflict) .SetDestinationProvider(CreateDestinationEventDictionary()) .SyncAsync(CancellationToken.None).ConfigureAwait(false); act.Should().Throw <NullReferenceException>().WithMessage($"The {nameof(BatchSyncAgent<int?, Event>.SourceProvider)} cannot be null."); }
internal static IBatchSyncAgent <int, Hobby> CreateSyncAgent(IDictionary <int, Hobby> sourceDictionary, IDictionary <int, Hobby> destinationDictionary) { return(BatchSyncAgent <int, Hobby> .Create() .SetComparerAgent(KeyComparerAgent <int> .Create()) .SetKeySelector(x => x.Id) .SetCompareItemFunc((s, d) => { if (s.Name == d.Name) { return MatchComparisonResultType.Same; } else { return MatchComparisonResultType.Conflict; } }) .SetSourceProvider(sourceDictionary) .SetDestinationProvider(destinationDictionary)); }