public async Task TestRemoving() { string fileName = CommaDelimitedFileUnitTest.ComposeFileName(); try { IReadOnlyCollection<string> columnNames = Enumerable.Range(0, CommaDelimitedFileUnitTest.CountColumns) .Select( (int item) => item.ToString(CultureInfo.InvariantCulture)) .ToArray(); IRow rowOne; ITabularFileAdapter fileStore = null; try { fileStore = new CommaDelimitedFileAdapter(fileName, columnNames); Assert.IsTrue(File.Exists(fileName)); Dictionary<string, string> columnsWritten = columnNames .ToDictionary( (string item) => item, (string item) => Guid.NewGuid().ToString()); rowOne = await fileStore.InsertRow(columnsWritten); Assert.IsNotNull(rowOne); Assert.IsFalse(string.IsNullOrWhiteSpace(rowOne.Key)); IRow rowTwo = await fileStore.InsertRow(columnsWritten); Assert.IsNotNull(rowTwo); Assert.IsFalse(string.IsNullOrWhiteSpace(rowTwo.Key)); Assert.IsFalse(string.Equals(rowOne.Key, rowTwo.Key, StringComparison.OrdinalIgnoreCase)); await fileStore.RemoveRow(rowOne.Key); } finally { if (fileStore != null) { fileStore.Dispose(); fileStore = null; } } IReadOnlyCollection<string> lines = File.ReadAllLines(fileName); Assert.AreEqual(2, lines.LongCount()); Assert.IsFalse( lines .Any( (string item) => item.StartsWith(rowOne.Key, StringComparison.OrdinalIgnoreCase))); } finally { if (File.Exists(fileName)) { File.Delete(fileName); } } }