New conversion complete
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Linq;
|
||||
using LeafWeb.Core.Charter;
|
||||
using LeafWeb.Core.Models;
|
||||
using LeafWeb.Core.Parsers;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeafWeb.Core.Tests.Charter
|
||||
{
|
||||
public class CurveDataConverterTests
|
||||
{
|
||||
private const string ContentDirectory = @"Parsers\LeafOutputData\";
|
||||
|
||||
[Test]
|
||||
public void Convert_Valid()
|
||||
{
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "cntrlcomparison_Wild Capsicum.csv");
|
||||
CntrlComparison[] cntrlComparison;
|
||||
using (var parser = new CntrlComparisonParser(fileInfo))
|
||||
cntrlComparison = parser.Parse();
|
||||
|
||||
var curves = CurveDataConverter.Convert(cntrlComparison);
|
||||
Assert.That(curves.Count(),Is.EqualTo(7));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,9 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Charter\CurveDataConverterTests.cs" />
|
||||
<Compile Include="Parsers\CntrlComparisonParserTests.cs" />
|
||||
<Compile Include="FileUtility.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Parsers\LeafInputCsvParserTests.cs" />
|
||||
<Compile Include="Parsers\CurveDataListTests.cs" />
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace LeafWeb.Core.Tests
|
||||
{
|
||||
public static class FileUtility
|
||||
{
|
||||
public static FileInfo GetContentFile(string contentDirectory, string fileName)
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, contentDirectory);
|
||||
return new FileInfo(path + fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,12 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[TestFixture]
|
||||
public class CntrlComparisonParserTests
|
||||
{
|
||||
protected const string ContentDirectory = @"Parsers\LeafOutputData\";
|
||||
|
||||
private static FileInfo GetContentFile(string fileName)
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ContentDirectory);
|
||||
return new FileInfo(path + fileName);
|
||||
}
|
||||
private const string ContentDirectory = @"Parsers\LeafOutputData\";
|
||||
|
||||
[Test]
|
||||
public void Parse_Valid()
|
||||
{
|
||||
var fileInfo = GetContentFile("cntrlcomparison_Wild Capsicum.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "cntrlcomparison_Wild Capsicum.csv");
|
||||
|
||||
CntrlComparison[] cntrlComparison;
|
||||
using (var parser = new CntrlComparisonParser(fileInfo))
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using LeafWeb.Core.Charter;
|
||||
using LeafWeb.Core.CharterOld;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace LeafWeb.Core.Tests.Parsers
|
||||
@@ -8,18 +6,12 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[TestFixture]
|
||||
public class CurveDataListTests
|
||||
{
|
||||
protected const string ContentDirectory = @"Services\LeafOutputData\";
|
||||
|
||||
private static FileInfo GetContentFile(string fileName)
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ContentDirectory);
|
||||
return new FileInfo(path + fileName);
|
||||
}
|
||||
private const string ContentDirectory = @"Parsers\LeafOutputData\";
|
||||
|
||||
[Test]
|
||||
public void Parse_Valid()
|
||||
{
|
||||
var fileInfo = GetContentFile("cntrlcomparison_Wild Capsicum.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "cntrlcomparison_Wild Capsicum.csv");
|
||||
var cntrlComparison = new CurveDataList();
|
||||
using (var reader = fileInfo.OpenText())
|
||||
{
|
||||
|
||||
@@ -12,18 +12,13 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[TestFixture]
|
||||
public class LeafInputCsvParserTests
|
||||
{
|
||||
protected const string ContentDirectory = @"Parsers\LeafInputData\";
|
||||
|
||||
private static FileInfo GetContentFile(string fileName)
|
||||
{
|
||||
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ContentDirectory);
|
||||
return new FileInfo(path + fileName);
|
||||
}
|
||||
|
||||
private const string ContentDirectory = @"Parsers\LeafInputData\";
|
||||
|
||||
[Test]
|
||||
public void Parse_Valid()
|
||||
{
|
||||
var fileInfo = GetContentFile("LeafInput-valid.csv");
|
||||
FileUtility.GetContentFile(ContentDirectory, "LeafInput-valid.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "LeafInput-valid.csv");
|
||||
var leafInput = new LeafInputCsvParser(fileInfo);
|
||||
var input = leafInput.Parse();
|
||||
|
||||
@@ -109,7 +104,7 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[Test]
|
||||
public void Parse_TitlesRemoved()
|
||||
{
|
||||
var fileInfo = GetContentFile("LeafInput-titlesRemoved.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "LeafInput-titlesRemoved.csv");
|
||||
var leafInput = new LeafInputCsvParser(fileInfo);
|
||||
var input = leafInput.Parse();
|
||||
|
||||
@@ -128,7 +123,7 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[Test]
|
||||
public void Parse_IncompleteRows()
|
||||
{
|
||||
var fileInfo = GetContentFile("LeafInput-incompleteRows.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "LeafInput-incompleteRows.csv");
|
||||
var parser = new LeafInputCsvParser(fileInfo);
|
||||
Assert.That(() => parser.Parse(), Throws.TypeOf<ParseException>());
|
||||
}
|
||||
@@ -136,7 +131,7 @@ namespace LeafWeb.Core.Tests.Parsers
|
||||
[Test]
|
||||
public void Parse_NoData()
|
||||
{
|
||||
var fileInfo = GetContentFile("LeafInput-noData.csv");
|
||||
var fileInfo = FileUtility.GetContentFile(ContentDirectory, "LeafInput-noData.csv");
|
||||
var parser = new LeafInputCsvParser(fileInfo);
|
||||
var input = parser.Parse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user