public TestResult <DMLibDataInfo> ExecuteTestCase(DMLibDataInfo sourceDataInfo, TestExecutionOptions <DMLibDataInfo> options)
        {
            this.CleanupData();
            SourceAdaptor.CreateIfNotExists();
            DestAdaptor.CreateIfNotExists();

            if (sourceDataInfo != null)
            {
                SourceAdaptor.GenerateData(sourceDataInfo);
            }

            if (options.DestTransferDataInfo != null)
            {
                DestAdaptor.GenerateData(options.DestTransferDataInfo);
            }

            if (options.AfterDataPrepared != null)
            {
                options.AfterDataPrepared();
            }

            List <TransferItem> allItems = new List <TransferItem>();

            foreach (var fileNode in sourceDataInfo.EnumerateFileNodes())
            {
                TransferItem item = new TransferItem()
                {
                    SourceObject  = SourceAdaptor.GetTransferObject(fileNode),
                    DestObject    = DestAdaptor.GetTransferObject(fileNode),
                    SourceType    = DMLibTestContext.SourceType,
                    DestType      = DMLibTestContext.DestType,
                    IsServiceCopy = DMLibTestContext.IsAsync,
                };

                if (options.TransferItemModifier != null)
                {
                    options.TransferItemModifier(fileNode, item);
                }

                allItems.Add(item);
            }

            return(this.RunTransferItems(allItems, options));
        }
        public TestResult <DMLibDataInfo> ExecuteTestCase(DMLibDataInfo sourceDataInfo, TestExecutionOptions <DMLibDataInfo> options)
        {
            if (options.DisableSourceCleaner)
            {
                this.CleanupData(false, true);
            }
            else
            {
                this.CleanupData();
            }
            SourceAdaptor.CreateIfNotExists();
            DestAdaptor.CreateIfNotExists();

            string  sourceRootPath = string.Empty;
            DirNode sourceRootNode = new DirNode(string.Empty);

            if (sourceDataInfo != null)
            {
                sourceRootPath = sourceDataInfo.RootPath;
                sourceRootNode = sourceDataInfo.RootNode;
                if (!options.DisableSourceGenerator)
                {
                    SourceAdaptor.GenerateData(sourceDataInfo);
                }
            }

            string destRootPath = string.Empty;

            if (options.DestTransferDataInfo != null)
            {
                destRootPath = options.DestTransferDataInfo.RootPath;
                DestAdaptor.GenerateData(options.DestTransferDataInfo);
            }

            if (options.AfterDataPrepared != null)
            {
                options.AfterDataPrepared();
            }

            List <TransferItem> allItems = new List <TransferItem>();

            if (options.IsDirectoryTransfer)
            {
                TransferItem item = new TransferItem()
                {
                    SourceObject        = SourceAdaptor.GetTransferObject(sourceRootPath, sourceRootNode, options.SourceCredentials),
                    DestObject          = DestAdaptor.GetTransferObject(destRootPath, sourceRootNode, options.DestCredentials),
                    SourceType          = DMLibTestContext.SourceType,
                    DestType            = DMLibTestContext.DestType,
                    IsServiceCopy       = DMLibTestContext.IsAsync,
                    IsDirectoryTransfer = true,
                };

                if (options.TransferItemModifier != null)
                {
                    options.TransferItemModifier(null, item);
                }

                allItems.Add(item);
            }
            else
            {
                foreach (var fileNode in sourceDataInfo.EnumerateFileNodes())
                {
                    TransferItem item = new TransferItem()
                    {
                        SourceObject  = SourceAdaptor.GetTransferObject(sourceDataInfo.RootPath, fileNode, options.SourceCredentials),
                        DestObject    = DestAdaptor.GetTransferObject(destRootPath, fileNode, options.DestCredentials),
                        SourceType    = DMLibTestContext.SourceType,
                        DestType      = DMLibTestContext.DestType,
                        IsServiceCopy = DMLibTestContext.IsAsync,
                    };

                    if (options.TransferItemModifier != null)
                    {
                        options.TransferItemModifier(fileNode, item);
                    }

                    allItems.Add(item);
                }
            }

            return(this.RunTransferItems(allItems, options));
        }