using System.Collections; namespace RhSolutions.ML.Tests; public abstract class DatasetBase : IEnumerable { protected virtual string FileName {get;set;} = string.Empty; public IEnumerator GetEnumerator() { string path = Path.Combine("..", "..", "..", "TestData", $"{FileName}.csv"); using FileStream stream = new(path, FileMode.Open, FileAccess.Read); StreamReader reader = new(stream); string? inputLine = reader.ReadLine(); while (inputLine != null) { var data = inputLine.Split(';'); yield return new Product { Name = data[0], Type = data[1] }; inputLine = reader.ReadLine(); } reader.Close(); stream.Close(); } }