using System; using System.Diagnostics; using LeafWeb.Core.Entities; using LeafWeb.Core.Parsers; using LeafWeb.Core.Utility; using NUnit.Framework; namespace LeafWeb.Core.Tests.Parsers { [TestFixture] public class LeafGasComparisonParserTests { private const string ContentDirectory = @"Parsers\LeafOutputData\"; [Test] public void Parse_Valid() { var fileInfo = FileUtility.GetContentFile(ContentDirectory, "leafgascomparison.csv"); LeafGasComparison[] leafGasComparisons; using (var parser = new LeafGasComparisonParser(fileInfo)) leafGasComparisons = parser.Parse(); Assert.That(leafGasComparisons.Length, Is.EqualTo(6)); } //[Test, Explicit] public void Parse_Timer() { var smallFileInfo = FileUtility.GetContentFile(ContentDirectory, "leafgascomparison.csv"); var largeFileInfo = FileUtility.GetContentFile(@"c:\temp\", "20160411095955C3_leafgascomparison.csv"); var timer = new Stopwatch(); timer.Start(); using (var parser = new LeafGasComparisonParser(smallFileInfo)) parser.Parse(); timer.Stop(); Console.WriteLine($"{timer.ElapsedMilliseconds}"); timer.Reset(); timer.Start(); using (var parser = new LeafGasComparisonParser(largeFileInfo)) parser.Parse(); timer.Stop(); Console.WriteLine($"{timer.ElapsedMilliseconds}"); } } }