public void RemoveRangeRemovesRangeWhenTheSameCollection(List <MockPoco> input)
        {
            // Arrange

            var fileName   = Path.GetRandomFileName();
            var outputFile = new FileInfo(Path.ChangeExtension(fileName, "csv"));

            CsvContext <MockPoco> csvContext = null;
            CsvRepo <MockPoco>    repository = null;

            try
            {
                csvContext = new CsvContext <MockPoco>(outputFile)
                {
                    Culture = CultureInfo.InvariantCulture
                };
                repository = new CsvRepo <MockPoco>(csvContext);

                // Act

                repository.AddRange(input);
                var unfortunateReference = repository.GetAll();
                repository.RemoveRange(unfortunateReference);
                csvContext.SaveChanges();


                // Assert

                var             rawAllText     = File.ReadAllText(outputFile.FullName);
                List <MockPoco> fromFileParsed = null;
                using (var csv = new CsvReader(new StringReader(rawAllText)))
                {
                    fromFileParsed = csv.GetRecords <MockPoco>().ToList();
                }

                var actual = fromFileParsed.GroupBy(x => x.Value).OrderBy(x => x.Key).Select(g => new { g.Key, Count = g.Count() }).ToList();

                Assert.Empty(actual);
            }
            finally
            {
                repository?.Dispose();

                outputFile.Delete();
            }
        }
        public void CsvRepTracksChangesOnItemsInContext(MockPoco input)
        {
            // Arrange

            var fileName   = Path.GetRandomFileName();
            var outputFile = new FileInfo(Path.ChangeExtension(fileName, "csv"));


            using (var streamWriter = outputFile.CreateText())
            {
                streamWriter.Write("Id,Value\r\n5,test5\r\n");
            }
            CsvContext <MockPoco> csvContext = null;
            CsvRepo <MockPoco>    repository = null;

            try
            {
                csvContext = new CsvContext <MockPoco>(outputFile)
                {
                    Culture = CultureInfo.InvariantCulture
                };
                repository = new CsvRepo <MockPoco>(csvContext);

                // Act

                repository.GetAll().First().Value = input.Value;
                csvContext.SaveChanges();

                var received = File.ReadAllText(outputFile.FullName);

                // Assert

                Assert.DoesNotContain("test5", received);
                Assert.Contains(input.Value, received);
            }
            finally
            {
                repository?.Dispose();

                outputFile.Delete();
            }
        }