コード例 #1
0
        public MainForm()
        {
            this.InitializeComponent();

            this.configuration = new SyncConfiguration();
            this.tempFilemanager.Init(true);
        }
コード例 #2
0
        public SyncEngine(ISyncConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.configuration = configuration;

            this.optigem = new OptigemConnector(this.configuration.OptigemDatabasePath);
            this.logDir  = new DirectoryInfo(Path.Combine(this.configuration.OptigemDatabasePath, "syncLogs"));

            if (!this.logDir.Exists)
            {
                this.logDir.Create();
            }

            string ldapConnection = this.optigem.GetLdapConnectionString();

            if (string.IsNullOrEmpty(ldapConnection))
            {
                throw new InvalidOperationException("No LDAP connection configured.");
            }

            var parser = new LdapConnectionStringParser {
                ConnectionString = ldapConnection
            };

            this.ldap = new LdapConnector(parser.Server, parser.Port, AuthType.Basic, parser.User, parser.Password, 100, this.configuration.WhatIf);

            this.groups = new GroupWorker(this.configuration, this.ldap, this.optigem);
        }
コード例 #3
0
        IAction ReadSleepAction(XElement actionElement, ISyncConfiguration configuration)
        {
            var enabled = ReadActionEnabled(actionElement);
            var timeout = ReadTimeSpan(actionElement.Element(XmlNames.Timeout));

            return(new SleepAction(enabled, configuration, timeout));
        }
コード例 #4
0
        IAction ReadReadSyncStateAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled  = ReadActionEnabled(actionElement);
            var fileName = pathResolver.GetAbsolutePath(actionElement.RequireAttributeValue(XmlAttributeNames.FileName));

            return(new ReadSyncStateAction(enabled, configuration, fileName));
        }
コード例 #5
0
        IAction ReadReleaseLockAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled  = ReadActionEnabled(actionElement);
            var lockFile = pathResolver.GetAbsolutePath(actionElement.RequireAttributeValue(XmlAttributeNames.LockFile));

            return(new ReleaseLockAction(enabled, configuration, lockFile));
        }
コード例 #6
0
        public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration dataProviderConfiguration, ISyncConfiguration syncConfiguration, PredicateRootPathResolver rootPathResolver)
        {
            Assert.ArgumentNotNull(targetDataStore, nameof(targetDataStore));
            Assert.ArgumentNotNull(predicate, nameof(predicate));
            Assert.ArgumentNotNull(fieldFilter, nameof(fieldFilter));
            Assert.ArgumentNotNull(logger, nameof(logger));
            Assert.ArgumentNotNull(sourceDataStore, nameof(sourceDataStore));
            Assert.ArgumentNotNull(dataProviderConfiguration, nameof(dataProviderConfiguration));
            Assert.ArgumentNotNull(rootPathResolver, nameof(rootPathResolver));
            Assert.ArgumentNotNull(syncConfiguration, nameof(syncConfiguration));

            _logger = logger;
            _dataProviderConfiguration = dataProviderConfiguration;
            _syncConfiguration = syncConfiguration;
            _rootPathResolver = rootPathResolver;
            _predicate = predicate;
            _fieldFilter = fieldFilter;
            _targetDataStore = targetDataStore;
            _sourceDataStore = sourceDataStore;

            // enable capturing recycle bin and archive restores to serialize the target item if included
            EventManager.Subscribe<RestoreItemCompletedEvent>(HandleItemRestored);

            try
            {
                _targetDataStore.RegisterForChanges(RemoveItemFromCaches);
            }
            catch (NotImplementedException)
            {
                // if the data store doesn't implement watching, cool story bruv
            }
        }
コード例 #7
0
        // TODO
        private UnicornDataProvider CreateTestProvider(Database db, ITargetDataStore targetDataStore = null, ISourceDataStore sourceDataStore = null, IPredicate predicate = null, IFieldFilter filter = null, IUnicornDataProviderLogger logger = null, ISyncConfiguration syncConfiguration = null, bool enableTransparentSync = false)
        {
            if (predicate == null)
            {
                predicate = CreateInclusiveTestPredicate();
            }

            if (filter == null)
            {
                filter = Substitute.For<IFieldFilter>();
                filter.Includes(Arg.Any<Guid>()).Returns(true);
            }

            targetDataStore = targetDataStore ?? Substitute.For<ITargetDataStore>();
            sourceDataStore = sourceDataStore ?? Substitute.For<ISourceDataStore>();
            syncConfiguration = syncConfiguration ?? Substitute.For<ISyncConfiguration>();

            var dp = new UnicornDataProvider(targetDataStore,
                sourceDataStore,
                predicate,
                filter,
                logger ?? Substitute.For<IUnicornDataProviderLogger>(),
                new DefaultUnicornDataProviderConfiguration(enableTransparentSync),
                syncConfiguration,
                new PredicateRootPathResolver(predicate, targetDataStore, sourceDataStore, Substitute.For<ILogger>()));

            dp.ParentDataProvider = db.GetDataProviders().First();

            return dp;
        }
コード例 #8
0
 void ReadActionList(XElement actionListElement, ISyncConfiguration configuration, IPathResolver pathResolver)
 {
     foreach (var actionElement in actionListElement.Elements())
     {
         ReadAction(actionElement, configuration, pathResolver);
     }
 }
コード例 #9
0
        public UnicornDataProvider(ITargetDataStore targetDataStore, ISourceDataStore sourceDataStore, IPredicate predicate, IFieldFilter fieldFilter, IUnicornDataProviderLogger logger, IUnicornDataProviderConfiguration dataProviderConfiguration, ISyncConfiguration syncConfiguration, PredicateRootPathResolver rootPathResolver)
        {
            Assert.ArgumentNotNull(targetDataStore, nameof(targetDataStore));
            Assert.ArgumentNotNull(predicate, nameof(predicate));
            Assert.ArgumentNotNull(fieldFilter, nameof(fieldFilter));
            Assert.ArgumentNotNull(logger, nameof(logger));
            Assert.ArgumentNotNull(sourceDataStore, nameof(sourceDataStore));
            Assert.ArgumentNotNull(dataProviderConfiguration, nameof(dataProviderConfiguration));
            Assert.ArgumentNotNull(rootPathResolver, nameof(rootPathResolver));
            Assert.ArgumentNotNull(syncConfiguration, nameof(syncConfiguration));

            _logger = logger;
            _dataProviderConfiguration = dataProviderConfiguration;
            _syncConfiguration         = syncConfiguration;
            _rootPathResolver          = rootPathResolver;
            _predicate       = predicate;
            _fieldFilter     = fieldFilter;
            _targetDataStore = targetDataStore;

            // enable capturing recycle bin and archive restores to serialize the target item if included
            EventManager.Subscribe <RestoreItemCompletedEvent>(HandleItemRestored);

            try
            {
                _targetDataStore.RegisterForChanges(RemoveItemFromCaches);
            }
            catch (NotImplementedException)
            {
                // if the data store doesn't implement watching, cool story bruv
            }
        }
コード例 #10
0
        IAction ReadApplyFilerAction(XElement actionElement, ISyncConfiguration configuration)
        {
            var enabled         = ReadActionEnabled(actionElement);
            var inputFilterName = ReadActionInputFilterName(actionElement);

            return(new ApplyFilterAction(enabled, configuration, inputFilterName));
        }
コード例 #11
0
 void ReadSyncConfiguration(XDocument configFile, ISyncConfiguration configuration, IPathResolver pathResolver)
 {
     foreach (var element in configFile.Root.Elements())
     {
         if (element.Name == XmlNames.Left)
         {
             configuration.Left = ReadSyncFolderDefinition(element, pathResolver);
         }
         else if (element.Name == XmlNames.Right)
         {
             configuration.Right = ReadSyncFolderDefinition(element, pathResolver);
         }
         else if (element.Name == XmlNames.Filter)
         {
             var filter = ReadFilter(element);
             configuration.AddFilter(filter);
         }
         else if (element.Name == XmlNames.Include)
         {
             ReadInclude(element, configuration, pathResolver);
         }
         else if (element.Name == XmlNames.TransferLocation)
         {
             configuration.AddTransferLocation(ReadTransferLocation(element, pathResolver));
         }
         else if (element.Name == XmlNames.Actions)
         {
             ReadActionList(element, configuration, pathResolver);
         }
         else
         {
             throw new ConfigurationException("Unknown element " + element.Name.LocalName + " in Configuration");
         }
     }
 }
コード例 #12
0
        IAction ReadTouchFileAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled = ReadActionEnabled(actionElement);
            var path    = pathResolver.GetAbsolutePath(actionElement.RequireAttributeValue(XmlAttributeNames.Path));
            var action  = new TouchFileAction(enabled, configuration, path);

            return(action);
        }
コード例 #13
0
        public PasswordMailForm()
        {
            this.InitializeComponent();

            this.configuration = new SyncConfiguration();
            this.userSelector.SetOptigemConnection(this.configuration);
            this.userSelector.UserAction += OnPrintClicked;
        }
コード例 #14
0
 public UpdateTransferStateAction(bool isEnabled, ISyncConfiguration configuration,
                                  string inputFilterName,
                                  IEnumerable <TransferLocationReference> transferLocationPaths,
                                  IEnumerable <string> interimLocations)
     : base(isEnabled, configuration, inputFilterName)
 {
     TransferLocationPaths = transferLocationPaths?.ToList() ?? throw new ArgumentNullException(nameof(transferLocationPaths));
     InterimLocations      = interimLocations?.ToList() ?? throw new ArgumentNullException(nameof(interimLocations));
 }
コード例 #15
0
        public void SetOptigemConnection(ISyncConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            this.optigem = new OptigemConnector(configuration.OptigemDatabasePath);
        }
コード例 #16
0
        protected LockAction(bool isEnabled, ISyncConfiguration configuration, string lockFile)
            : base(isEnabled, configuration, null)
        {
            if (String.IsNullOrEmpty(lockFile))
            {
                throw new ArgumentNullException(lockFile);
            }

            LockFile = lockFile;
        }
コード例 #17
0
        IAction ReadCopyAction(XElement actionElement, ISyncConfiguration configuration)
        {
            var enabled         = ReadActionEnabled(actionElement);
            var inputFilterName = ReadActionInputFilterName(actionElement);
            var syncFolder      = ReadActionSyncFolder(actionElement);

            var actionInstance = new CopyAction(enabled, configuration, inputFilterName, syncFolder);

            return(actionInstance);
        }
コード例 #18
0
        public TouchFileAction(bool isEnabled, ISyncConfiguration configuration, string path)
            : base(isEnabled, configuration, null)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentException("Value must not be empty", nameof(path));
            }

            Path = path;
        }
コード例 #19
0
        IAction ReadImportAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled         = ReadActionEnabled(actionElement);
            var inputFilterName = ReadActionInputFilterName(actionElement);
            var syncFolder      = ReadActionSyncFolder(actionElement);

            var action = new ImportAction(enabled, configuration, inputFilterName, syncFolder);

            ApplyCommonImportExportActionProperties(actionElement, action, configuration, pathResolver);
            return(action);
        }
コード例 #20
0
        IAction ReadCompareAction(XElement actionElement, ISyncConfiguration configuration)
        {
            var enabled    = ReadActionEnabled(actionElement);
            var filterName = ReadActionInputFilterName(actionElement);

            var timeStampMarginElement = actionElement.Element(XmlNames.TimeStampMargin);
            var timeStampMargin        = (timeStampMarginElement == null)
                                ? TimeSpan.FromSeconds(0)
                                : ReadTimeSpan(timeStampMarginElement);

            return(new CompareAction(enabled, filterName, configuration, timeStampMargin));
        }
コード例 #21
0
        IAction ReadUpdateTransferStateAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled = ReadActionEnabled(actionElement);

            var transferLocationPaths = actionElement.Elements(XmlNames.TransferLocation).Select(ReadTransferLocationReference);

            var interimLocations = actionElement.Elements(XmlNames.InterimLocation)
                                   .Select(xml => xml.RequireAttributeValue(XmlAttributeNames.Path))
                                   .Select(pathResolver.GetAbsolutePath);

            return(new UpdateTransferStateAction(enabled, configuration, null, transferLocationPaths, interimLocations));
        }
コード例 #22
0
        IAction ReadExportDirectoryAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled = ReadActionEnabled(actionElement);
            // SyncFolder and input filter not relevant for this action, so just use default values
            var action = new ExportDirectoryAction(enabled, configuration, default(string), default(SyncFolder))
            {
                SourcePath        = pathResolver.GetAbsolutePath(actionElement.RequireAttributeValue(XmlAttributeNames.Path)),
                DeleteSourceFiles = ParseBool(actionElement.Attribute(XmlAttributeNames.DeleteSourceFiles)?.Value ?? "false")
            };

            ApplyCommonImportExportActionProperties(actionElement, action, configuration, pathResolver);
            return(action);
        }
コード例 #23
0
ファイル: MovieScrapper.cs プロジェクト: nazarkryp/webapp
 public MovieScrapper(
     IConcurrentActionHandler concurrentActionHandler,
     ISyncConfiguration syncConfiguration,
     ISyncDetailsRepository syncDetailsRepository,
     IStudioRepository studioRepository,
     IMovieRepository movieRepository,
     IMapper mapper)
 {
     _concurrentActionHandler = concurrentActionHandler;
     _syncConfiguration       = syncConfiguration;
     _syncDetailsRepository   = syncDetailsRepository;
     _studioRepository        = studioRepository;
     _movieRepository         = movieRepository;
     _mapper = mapper;
 }
コード例 #24
0
        /// <summary>
        /// Initializes a new instance of RunSyncJobAction
        /// </summary>
        /// <param name="isEnabled"></param>
        /// <param name="configuration"></param>
        /// <param name="inputFilterName"></param>
        /// <param name="configurationPath">The path of the sync configuration to load and execute</param>
        /// <exception cref="ArgumentNullException">Thrown if configurationPath is null</exception>
        /// <exception cref="ArgumentException">Thrown if configurationPath is empty</exception>
        public RunSyncJobAction(bool isEnabled, ISyncConfiguration configuration, string inputFilterName, string configurationPath)
            : base(isEnabled, configuration, inputFilterName)
        {
            if (configurationPath == null)
            {
                throw new ArgumentNullException(nameof(configurationPath));
            }

            if (String.IsNullOrWhiteSpace(configurationPath))
            {
                throw new ArgumentException("Value must not be empty", nameof(configurationPath));
            }

            ConfigurationPath = configurationPath;
        }
コード例 #25
0
        IAction ReadAquireLockAction(XElement actionElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var enabled  = ReadActionEnabled(actionElement);
            var lockFile = pathResolver.GetAbsolutePath(actionElement.RequireAttributeValue(XmlAttributeNames.LockFile));

            TimeSpan?timeout = null;

            if (actionElement.Element(XmlNames.Timeout) != null)
            {
                timeout = ReadTimeSpan(actionElement.Element(XmlNames.Timeout));
            }

            var action = new AcquireLockAction(enabled, configuration, lockFile, timeout);

            return(action);
        }
コード例 #26
0
        void ReadInclude(XElement includeElement, ISyncConfiguration configuration, IPathResolver pathResolver)
        {
            var includePath = pathResolver.GetAbsolutePath(includeElement.RequireAttributeValue(XmlAttributeNames.Path));

            if (!File.Exists(includePath))
            {
                throw new ConfigurationException(String.Format("Included configuration file '{0}' not found", includePath));
            }

            var configurationDocument = XDocument.Load(includePath);

            configurationDocument = m_Migrator.UpgradeConfigurationFile(configurationDocument);

            var includePathResolver = new PathResolver(Path.GetDirectoryName(includePath));

            ReadSyncConfiguration(configurationDocument, configuration, includePathResolver);
        }
コード例 #27
0
        public SerializationLoader(ISourceDataStore sourceDataStore, ITargetDataStore targetDataStore, IPredicate predicate, IEvaluator evaluator, ISerializationLoaderLogger logger, ISyncConfiguration syncConfiguration, PredicateRootPathResolver predicateRootPathResolver)
        {
            Assert.ArgumentNotNull(targetDataStore, nameof(targetDataStore));
            Assert.ArgumentNotNull(sourceDataStore, nameof(sourceDataStore));
            Assert.ArgumentNotNull(predicate, nameof(predicate));
            Assert.ArgumentNotNull(evaluator, nameof(evaluator));
            Assert.ArgumentNotNull(logger, nameof(logger));
            Assert.ArgumentNotNull(predicateRootPathResolver, nameof(predicateRootPathResolver));
            Assert.ArgumentNotNull(syncConfiguration, nameof(syncConfiguration));

            Logger = logger;
            SyncConfiguration = syncConfiguration;
            PredicateRootPathResolver = predicateRootPathResolver;
            Evaluator = evaluator;
            Predicate = predicate;
            TargetDataStore = targetDataStore;
            SourceDataStore = sourceDataStore;
        }
コード例 #28
0
        public SerializationLoader(ISourceDataStore sourceDataStore, ITargetDataStore targetDataStore, IPredicate predicate, IEvaluator evaluator, ISerializationLoaderLogger logger, ISyncConfiguration syncConfiguration, PredicateRootPathResolver predicateRootPathResolver)
        {
            Assert.ArgumentNotNull(targetDataStore, nameof(targetDataStore));
            Assert.ArgumentNotNull(sourceDataStore, nameof(sourceDataStore));
            Assert.ArgumentNotNull(predicate, nameof(predicate));
            Assert.ArgumentNotNull(evaluator, nameof(evaluator));
            Assert.ArgumentNotNull(logger, nameof(logger));
            Assert.ArgumentNotNull(predicateRootPathResolver, nameof(predicateRootPathResolver));
            Assert.ArgumentNotNull(syncConfiguration, nameof(syncConfiguration));

            Logger                    = logger;
            SyncConfiguration         = syncConfiguration;
            PredicateRootPathResolver = predicateRootPathResolver;
            Evaluator                 = evaluator;
            Predicate                 = predicate;
            TargetDataStore           = targetDataStore;
            SourceDataStore           = sourceDataStore;
        }
コード例 #29
0
        public GroupWorker(ISyncConfiguration configuration, LdapConnector ldap, OptigemConnector optigem)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (ldap == null)
            {
                throw new ArgumentNullException(nameof(ldap));
            }
            if (optigem == null)
            {
                throw new ArgumentNullException(nameof(optigem));
            }

            this.configuration = configuration;
            this.ldap          = ldap;
            this.optigem       = optigem;
        }
コード例 #30
0
 public ReleaseLockAction(bool isEnabled, ISyncConfiguration configuration, string lockFile)
     : base(isEnabled, configuration, lockFile)
 {
 }
コード例 #31
0
 public ReadSyncStateAction(bool isEnabled, ISyncConfiguration configuration, string fileName)
     : base(isEnabled, configuration, null)
 {
     FileName = fileName;
 }
コード例 #32
0
 public AcquireLockAction(bool isEnabled, ISyncConfiguration configuration, string lockFile, TimeSpan?timeout)
     : base(isEnabled, configuration, lockFile)
 {
     Timeout = timeout;
 }
コード例 #33
0
 public AcquireLockAction(bool isEnabled, ISyncConfiguration configuration, string lockFile)
     : this(isEnabled, configuration, lockFile, null)
 {
 }
コード例 #34
0
ファイル: LoaderTests.cs プロジェクト: Eldblom/Unicorn
        //[Fact]
        //public void LoadTree_IdentifiesOrphanChildItem()
        //{
        //    var root = CreateTestTree(2);
        //    var serializedRootItem = new FakeItem("Root");
        //    serializedRootItem.SetupGet(y => y.DatabaseName).Returns("flag");
        //    var predicate = CreateInclusiveTestPredicate();
        //    var serializationProvider = Substitute.For<ITargetDataStore>();
        //    serializationProvider.Setup(x => x.GetReference(root)).Returns(serializedRootItem);
        //    var sourceDataProvider = Substitute.For<ISourceDataProvider>();
        //    sourceDataProvider.Setup(x => x.GetItemById("flag", It.IsAny<ID>())).Returns(root);
        //    var evaluator = Substitute.For<IEvaluator>();
        //    var loader = CreateTestLoader(sourceDataProvider, serializationProvider, predicate, evaluator, null);
        //    TestLoadTree(loader, serializedRootItem);
        //    evaluator.Verify(x => x.EvaluateOrphans(It.Is<ISourceItem[]>(y => y.Contains(root.Children[0]))));
        //}
        //[Fact]
        //public void LoadTree_DoesNotIdentifyValidChildrenAsOrphans()
        //{
        //    var root = CreateTestTree(2);
        //    var serializedRootItem = new FakeItem("Root");
        //    serializedRootItem.SetupGet(y => y.DatabaseName).Returns("flag");
        //    var serializedChildItem = new FakeItem("Child");
        //    serializedChildItem.SetupGet(y => y.DatabaseName).Returns("childflag");
        //    serializedRootItem.Setup(x => x.GetChildItems()).Returns(new[] { serializedChildItem });
        //    var predicate = CreateInclusiveTestPredicate();
        //    var serializationProvider = Substitute.For<ITargetDataStore>();
        //    serializationProvider.Setup(x => x.GetReference(root)).Returns(serializedRootItem);
        //    var sourceDataProvider = Substitute.For<ISourceDataProvider>();
        //    sourceDataProvider.Setup(x => x.GetItemById("flag", It.IsAny<ID>())).Returns(root);
        //    sourceDataProvider.Setup(x => x.GetItemById("childflag", It.IsAny<ID>())).Returns(root.Children[0]);
        //    var evaluator = Substitute.For<IEvaluator>();
        //    var loader = CreateTestLoader(sourceDataProvider, serializationProvider, predicate, evaluator, null);
        //    TestLoadTree(loader, serializedRootItem);
        //    evaluator.Verify(x => x.EvaluateOrphans(It.IsAny<ISourceItem[]>()), Times.Never());
        //}
        //[Fact]
        //public void LoadTree_DoesNotIdentifySkippedItemsAsOrphans()
        //{
        //    var root = CreateTestTree(2);
        //    var serializedRootItem = new FakeItem("Root");
        //    var predicate = CreateExclusiveTestPredicate(new[] { serializedRootItem }, new[] { root });
        //    var serializationProvider = Substitute.For<ITargetDataStore>();
        //    serializationProvider.Setup(x => x.GetReference(root)).Returns(serializedRootItem);
        //    var sourceDataProvider = Substitute.For<ISourceDataProvider>();
        //    sourceDataProvider.Setup(x => x.GetItemById(It.IsAny<string>(), It.IsAny<ID>())).Returns(root);
        //    var evaluator = Substitute.For<IEvaluator>();
        //    var loader = CreateTestLoader(sourceDataProvider, serializationProvider, predicate, evaluator, null);
        //    TestLoadTree(loader, serializedRootItem);
        //    evaluator.Verify(x => x.EvaluateOrphans(It.IsAny<ISourceItem[]>()), Times.Never());
        //}
        //[Fact]
        //public void LoadTree_UpdatesWhenItemDoesNotExistInSource()
        //{
        //    var root = CreateTestTree(1);
        //    var serializedRootItem = new FakeItem("Root");
        //    serializedRootItem.SetupGet(y => y.DatabaseName).Returns("flag");
        //    var serializedChildItem = new FakeItem("Child");
        //    serializedRootItem.Setup(x => x.GetChildItems()).Returns(new[] { serializedChildItem });
        //    var predicate = CreateInclusiveTestPredicate();
        //    var serializationProvider = Substitute.For<ITargetDataStore>();
        //    serializationProvider.Setup(x => x.GetReference(root)).Returns(serializedRootItem);
        //    var sourceDataProvider = Substitute.For<ISourceDataProvider>();
        //    sourceDataProvider.Setup(x => x.GetItemById("flag", It.IsAny<ID>())).Returns(root);
        //    var evaluator = Substitute.For<IEvaluator>();
        //    var loader = CreateTestLoader(sourceDataProvider, serializationProvider, predicate, evaluator, null);
        //    TestLoadTree(loader, serializedRootItem);
        //    evaluator.Verify(x => x.EvaluateNewSerializedItem(serializedChildItem));
        //}
        //[Fact]
        //public void LoadTree_AbortsWhenConsistencyCheckFails()
        //{
        //    var root = CreateTestTree(1);
        //    var serializedRootItem = new FakeItem("Test");
        //    serializedRootItem.Setup(x => x.Deserialize(false)).Returns(root);
        //    var predicate = CreateInclusiveTestPredicate();
        //    var serializationProvider = Substitute.For<ITargetDataStore>();
        //    serializationProvider.Setup(x => x.GetReference(It.IsAny<ISourceItem>())).Returns(serializedRootItem);
        //    var logger = Substitute.For<ISerializationLoaderLogger>();
        //    var consistencyChecker = Substitute.For<IConsistencyChecker>();
        //    consistencyChecker.Setup(x => x.IsConsistent(It.IsAny<IItemData>())).Returns(false);
        //    var loader = CreateTestLoader(null, serializationProvider, predicate, null, logger);
        //    Assert.Throws<ConsistencyException>((() => loader.LoadTree(serializedRootItem, Substitute.For<IDeserializeFailureRetryer>(), consistencyChecker)));
        //}
        private SerializationLoader CreateTestLoader(ISourceDataStore sourceDataStore = null, ITargetDataStore targetDataStore = null, IPredicate predicate = null, IEvaluator evaluator = null, ISyncConfiguration syncConfiguration = null, ISerializationLoaderLogger logger = null)
        {
            targetDataStore = targetDataStore ?? Substitute.For<ITargetDataStore>();
            sourceDataStore = sourceDataStore ?? Substitute.For<ISourceDataStore>();
            predicate = predicate ?? CreateInclusiveTestPredicate();
            evaluator = evaluator ?? Substitute.For<IEvaluator>();
            logger = logger ?? Substitute.For<ISerializationLoaderLogger>();
            syncConfiguration = syncConfiguration ?? new TestSyncConfiguration();

            var mockLogger2 = Substitute.For<ILogger>();

            var pathResolver = new PredicateRootPathResolver(predicate, targetDataStore, sourceDataStore, mockLogger2);

            return new SerializationLoader(sourceDataStore, targetDataStore, predicate, evaluator, logger, syncConfiguration, pathResolver);
        }