public Task <bool> AddAsync(IEnumerable <TestCaseInfo> items) { Task <bool> newTask = new Task <bool>(() => { string assemblyFolder = this.configurationManager.GetConfigValue(Constants.TestAssembliesFolder); IEnumerable <string> testAssembly = (from r in items select r.Source).Distinct(StringComparer.InvariantCultureIgnoreCase); testAssembly = this.CopyFile(testAssembly); foreach (TestCaseInfo testCase in items) { string orignalSource = Path.GetFileName(testCase.Source); testCase.Source = Path.Combine(assemblyFolder, orignalSource, orignalSource); if (!this.methodInfos.Contains(testCase)) { this.methodInfos.Add(testCase); } } string output = TestCaseInfo.SerializeList(this.methodInfos); File.WriteAllText(defaultReposFile, output, this.configurationManager.GetEncoding()); return(true); }); newTask.Start(); return(newTask); }
public Task <bool> DeleteAsync(Guid id) { int count = this.methodInfos.RemoveAll(o => o.Id.Equals(id)); string output = TestCaseInfo.SerializeList(this.methodInfos); File.WriteAllText(defaultReposFile, output, this.configurationManager.GetEncoding()); return(Task.FromResult(count == 1)); }
public Task <bool> DeleteRange(IEnumerable <TestCaseInfo> items) { int count = this.methodInfos.RemoveAll(o => items.Contains(o)); string output = TestCaseInfo.SerializeList(this.methodInfos); File.WriteAllText(defaultReposFile, output, this.configurationManager.GetEncoding()); return(Task.FromResult(count == 1)); }