public void Sort_ProvideTwoFilesAndSwapOrders_ReturnsDifferentOrder() { var sysIgnoredFileProvider = Substitute.For <ISysIgnoredFileProvider>(); sysIgnoredFileProvider.GetIgnoredFiles().Returns(new List <string>()); var selector = new SqlSelector(sysIgnoredFileProvider); var files = new List <string>() { "file 1", "file 2" }.AsEnumerable(); Assert.IsTrue(files.First() == "file 1"); var order = new SqlOrderConfiguration() { FileOrder = new List <string>() { "file 2" } }; selector.Sort(order, ref files); Assert.IsTrue(files.First() == "file 2"); }
public void Sort(SqlOrderConfiguration orderConfiguration, ref IEnumerable <string> files) { var allFiles = files.ToList(); var sortedFiles = new List <string>(); foreach (var file in orderConfiguration.FileOrder) { if (allFiles.Contains(file)) { sortedFiles.Add(file); allFiles.Remove(file); } } sortedFiles.AddRange(allFiles); files = sortedFiles; }
public DeliveryCommand(IRepository repository, DbNegotiator dbNegotiator, ISqlSelector sqlSelector, IFileReader fileReader, SqlIgnoreConfiguration sqlIgnoreConfiguration, SqlOrderConfiguration sqlOrderConfiguration, BaseConfiguration baseConfiguration, Command command, IDbPrepare dbPrepare) { _repository = repository; _dbNegotiator = dbNegotiator; _sqlSelector = sqlSelector; _fileReader = fileReader; _sqlIgnoreConfiguration = sqlIgnoreConfiguration; _sqlOrderConfiguration = sqlOrderConfiguration; _baseConfiguration = baseConfiguration; _command = command; _dbPrepare = dbPrepare; }