CntrlComparison parsing

This commit is contained in:
2015-12-04 10:15:51 -05:00
parent 4d46f206ac
commit 685e8c8658
39 changed files with 820 additions and 491 deletions
+17 -6
View File
@@ -43,24 +43,35 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Parsers\CntrlComparisonParserTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\LeafInputCsvParserTests.cs" />
<Compile Include="Parsers\LeafInputCsvParserTests.cs" />
<Compile Include="Parsers\CurveDataListTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<Content Include="Services\LeafInputData\LeafInput-valid.csv">
<Content Include="Parsers\LeafInputData\LeafInput-valid.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Services\LeafInputData\LeafInput-titlesRemoved.csv">
<Content Include="Parsers\LeafInputData\LeafInput-titlesRemoved.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Services\LeafInputData\LeafInput-incompleteRows.csv">
<Content Include="Parsers\LeafInputData\LeafInput-incompleteRows.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Services\LeafInputData\LeafInput-noData.csv">
<Content Include="Parsers\LeafInputData\LeafInput-noData.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Parsers\LeafInputData\LeafInput-tabSeparated.csv" />
<Content Include="Parsers\LeafOutputData\cntrlbestparameters_Wild Capsicum.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Parsers\LeafOutputData\cntrlcomparison_Wild Capsicum.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Parsers\LeafOutputData\cntrlparameters_Wild Capsicum.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Services\LeafInputData\LeafInput-tabSeparated.csv" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
+1
View File
@@ -1,2 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=parsers_005Cleafinputdata/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Services_005CLeafInputData/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using LeafWeb.Core.Models;
using LeafWeb.Core.Parsers;
using NUnit.Framework;
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);
}
[Test]
public void Parse_Valid()
{
var fileInfo = GetContentFile("cntrlcomparison_Wild Capsicum.csv");
CntrlComparison[] cntrlComparison;
using (var parser = new CntrlComparisonParser(fileInfo))
cntrlComparison = parser.Parse();
Assert.That(cntrlComparison.Length, Is.EqualTo(7 * 4));
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.IO;
using LeafWeb.Core.Charter;
using NUnit.Framework;
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);
}
[Test]
public void Parse_Valid()
{
var fileInfo = GetContentFile("cntrlcomparison_Wild Capsicum.csv");
var cntrlComparison = new CurveDataList();
using (var reader = fileInfo.OpenText())
{
cntrlComparison.ReadFromStream(reader);
}
Assert.That(cntrlComparison.CurveData.Count, Is.EqualTo(7));
}
}
}
@@ -3,15 +3,16 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using LeafWeb.Core.Models;
using LeafWeb.Core.Services;
using LeafWeb.Core.Parsers;
using LeafWeb.Core.Utility;
using NUnit.Framework;
namespace LeafWeb.Core.Tests.Services
namespace LeafWeb.Core.Tests.Parsers
{
[TestFixture]
public class LeafInputCsvParserTests
{
protected const string ContentDirectory = @"Services\LeafInputData\";
protected const string ContentDirectory = @"Parsers\LeafInputData\";
private static FileInfo GetContentFile(string fileName)
{
@@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace LeafWeb.Core.Tests.Services
{
[TestFixture]
public class CntrlComparisonCsvParserTests
{
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);
}
}
}