Example #1
0
        /// <summary>
        /// Sets the source comparer and sync providers.
        /// </summary>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TItem">The type of the item.</typeparam>
        /// <param name="syncAgent">The sync agent.</param>
        /// <param name="sourceProvider">The source comparer and sync providers.</param>
        /// <returns></returns>
        public static ISyncAgent <TKey, TItem> SetSourceProvider <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, IComparerSyncProvider <TItem> sourceProvider)
        {
            if (syncAgent.ComparerAgent == null)
            {
                throw new NullReferenceException($"The {nameof(syncAgent.ComparerAgent)} must be set first.");
            }

            syncAgent.ComparerAgent.SourceProvider = sourceProvider;
            syncAgent.SourceProvider = sourceProvider;

            return(syncAgent);
        }
        public void WhenTheSymphonyPlatformHasNoConflictsForTheNewMeetings()
        {
            mocker.GetMock <ISymphonyRepository>()
            .Setup(mock => mock.SaveConference(It.IsAny <Conference>()))
            .Returns(new SchedulingResponse()
            {
                ConfirmationNumber = 1
            });
            mocker.GetMock <ISymphonyRepository>()
            .Setup(mock => mock.SetConferenceStatus(It.IsAny <long>(), It.IsAny <ScheduleStatus>()))
            .Returns(true);

            _agent = new SvmAgent(mocker.Resolve <ISymphonyRepository>());
        }
Example #3
0
        /// <summary>
        /// Sets the destination items.
        /// </summary>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TItem">The type of the item.</typeparam>
        /// <param name="syncAgent">The sync agent.</param>
        /// <param name="items">The destination items.</param>
        /// <returns></returns>
        public static ISyncAgent <TKey, TItem> SetDestinationProvider <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, SortedSet <TItem> items)
        {
            if (items == null)
            {
                throw new NullReferenceException($"The destination {nameof(items)} cannot be null.");
            }
            if (syncAgent.ComparerAgent == null)
            {
                throw new NullReferenceException($"The {nameof(syncAgent.ComparerAgent)} must be set first.");
            }

            syncAgent.ComparerAgent.SetDestinationProvider(items);
            syncAgent.DestinationProvider = new SortedSetSyncProvider <TItem> {
                Items = items
            };

            return(syncAgent);
        }
Example #4
0
        // SP Added dependency on ISyncAgent, removed start/stoprequested events in favor of direct calls to the interface methods
        public MainWindowViewModel(ISyncManager syncManager,
                                   LogListener listener,
                                   ISyncAgent syncAgent)
        {
            _syncAgent   = syncAgent;
            _syncManager = syncManager;

            _log = new LinkedList <string>();
            listener.LogCreated += OnLogCreated;

            _showCompleteJobs     = true;
            StartSyncCommand      = new RelayCommand(() => StartSync());
            ToggleDMTAgentCommand = new RelayCommand(() => ToggleDMTAgent());

            SyncElements = GetSyncElements(_syncManager);

            _syncAgent.StatusChanged += OnAgentStatusChanged;
            _syncManager.JobController.NewJobStarted += OnJobStarted;
            _syncManager.JobController.JobCompleted  += OnJobCompleted;
        }
Example #5
0
 public void setup()
 {
     mocker.GetMock <ISyncAgent>();
     _sut = mocker.Resolve <ISyncAgent>();
 }
Example #6
0
        /// <summary>
        /// Sets the destination sync provider.
        /// </summary>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TItem">The type of the item.</typeparam>
        /// <param name="syncAgent">The sync agent.</param>
        /// <param name="syncProvider">The destination sync provider of the sync agent.</param>
        /// <returns></returns>
        public static ISyncAgent <TKey, TItem> SetDestinationProvider <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, ISyncProvider <TItem> syncProvider)
        {
            syncAgent.DestinationProvider = syncProvider;

            return(syncAgent);
        }
Example #7
0
        /// <summary>
        /// Sets the source sync provider.
        /// </summary>
        /// <typeparam name="TKey">The type of the key.</typeparam>
        /// <typeparam name="TItem">The type of the item.</typeparam>
        /// <param name="syncAgent">The sync agent.</param>
        /// <param name="syncProvider">The source sync provider of the sync agent.</param>
        /// <returns></returns>
        public static ISyncAgent <TKey, TItem> SetSourceProvider <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, ISyncProvider <TItem> syncProvider)
        {
            syncAgent.SourceProvider = syncProvider;

            return(syncAgent);
        }
Example #8
0
 /// <summary>
 /// Sets the comparer agent of the sync agent.
 /// </summary>
 /// <typeparam name="TKey">The type of the key.</typeparam>
 /// <typeparam name="TItem">The type of the item.</typeparam>
 /// <param name="syncAgent">The sync agent.</param>
 /// <param name="comparerAgent">The comparer agent.</param>
 /// <returns></returns>
 public static ISyncAgent <TKey, TItem> SetComparerAgent <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, IComparerAgent <TKey, TItem> comparerAgent)
 {
     syncAgent.ComparerAgent = comparerAgent;
     return(syncAgent);
 }
Example #9
0
 /// <summary>
 /// Sets the BeforeSyncingAction.
 /// </summary>
 /// <typeparam name="TKey">The type of the key.</typeparam>
 /// <typeparam name="TItem">The type of the item.</typeparam>
 /// <param name="syncAgent">The sync agent.</param>
 /// <param name="beforeSyncingAction">An action to be called before syncing the items.</param>
 /// <returns></returns>
 public static ISyncAgent <TKey, TItem> SetBeforeSyncingAction <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, Action <ComparisonResult <TItem> > beforeSyncingAction)
 {
     syncAgent.BeforeSyncingAction = beforeSyncingAction;
     return(syncAgent);
 }
Example #10
0
 /// <summary>
 /// Configures the sync agent.
 /// </summary>
 /// <typeparam name="TKey">The type of the key.</typeparam>
 /// <typeparam name="TItem">The type of the item.</typeparam>
 /// <param name="syncAgent">The sync agent.</param>
 /// <param name="configure">The configure action.</param>
 /// <returns></returns>
 public static ISyncAgent <TKey, TItem> Configure <TKey, TItem>(this ISyncAgent <TKey, TItem> syncAgent, Action <ISyncConfigurations> configure)
 {
     configure?.Invoke(syncAgent.Configurations);
     return(syncAgent);
 }