Skip to content

Commit

Permalink
Issue #87 Release 2.7.0
Browse files Browse the repository at this point in the history
Fix Extension Methods and now target the interface instead of the implementation.
  • Loading branch information
bytefish committed Jun 3, 2022
1 parent 0d8c574 commit 1ebf317
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
Binary file not shown.
Binary file not shown.
Expand Up @@ -19,8 +19,8 @@ protected override ITypeConverter<Double> Converter
get
{
return new[] {
MakeTuple(Double.MinValue.ToString("R"), Double.MinValue),
MakeTuple(Double.MaxValue.ToString("R"), Double.MaxValue),
MakeTuple(double.MinValue.ToString("R"), double.NegativeInfinity),
MakeTuple(double.MaxValue.ToString("R"), double.PositiveInfinity),
MakeTuple("0", 0),
MakeTuple("-1000", -1000),
MakeTuple("1000", 1000),
Expand All @@ -31,7 +31,7 @@ protected override ITypeConverter<Double> Converter

public override void AssertAreEqual(Double expected, Double actual)
{
Assert.AreEqual(expected, actual, Double.Epsilon);
Assert.AreEqual(expected, actual, 1e-5);
}

protected override string[] FailTestData
Expand Down
Expand Up @@ -20,8 +20,8 @@ public class NullableDoubleConverterTest : BaseConverterTest<Double?>
get
{
return new[] {
MakeTuple(Double.MinValue.ToString("R"), Double.MinValue),
MakeTuple(Double.MaxValue.ToString("R"), Double.MaxValue),
MakeTuple(double.MinValue.ToString("R"), double.NegativeInfinity),
MakeTuple(double.MaxValue.ToString("R"), double.PositiveInfinity),
MakeTuple("0", 0),
MakeTuple("-1000", -1000),
MakeTuple("1000", 1000),
Expand All @@ -33,15 +33,15 @@ public class NullableDoubleConverterTest : BaseConverterTest<Double?>
}
}

public override void AssertAreEqual(Double? expected, Double? actual)
public override void AssertAreEqual(double? expected, double? actual)
{
if (expected == default(Double?))
if (expected == default(double?))
{
Assert.AreEqual(expected, actual);
}
else
{
Assert.AreEqual(actual, Is.EqualTo(expected.Value).Within(double.Epsilon));
Assert.That(actual.Value, Is.EqualTo(expected.Value).Within(double.Epsilon));
}
}

Expand Down
Expand Up @@ -20,8 +20,8 @@ public class NullableSingleConverterTest : BaseConverterTest<Single?>
get
{
return new[] {
MakeTuple(Single.MinValue.ToString("R"), Single.MinValue),
MakeTuple(Single.MaxValue.ToString("R"), Single.MaxValue),
MakeTuple(float.MinValue.ToString("R"), float.NegativeInfinity),
MakeTuple(float.MaxValue.ToString("R"), float.PositiveInfinity),
MakeTuple("0", 0),
MakeTuple("-1000", -1000),
MakeTuple("1000", 1000),
Expand All @@ -41,7 +41,7 @@ public override void AssertAreEqual(float? expected, float? actual)
}
else
{
Assert.AreEqual(actual, Is.EqualTo(expected.Value).Within(float.Epsilon));
Assert.That(actual, Is.EqualTo(expected.Value).Within(float.Epsilon));
}
}

Expand Down
Expand Up @@ -19,8 +19,8 @@ protected override ITypeConverter<Single> Converter
get
{
return new[] {
MakeTuple(Single.MinValue.ToString("R"), Single.MinValue),
MakeTuple(Single.MaxValue.ToString("R"), Single.MaxValue),
MakeTuple(float.MinValue.ToString("R"), float.NegativeInfinity),
MakeTuple(float.MaxValue.ToString("R"), float.PositiveInfinity),
MakeTuple("0", 0),
MakeTuple("-1000", -1000),
MakeTuple("1000", 1000),
Expand All @@ -31,7 +31,7 @@ protected override ITypeConverter<Single> Converter

public override void AssertAreEqual(float expected, float actual)
{
Assert.AreEqual(expected, actual, float.Epsilon);
Assert.That(actual, Is.EqualTo(expected).Within(float.Epsilon));
}

protected override string[] FailTestData
Expand Down
6 changes: 3 additions & 3 deletions TinyCsvParser/TinyCsvParser/CsvParserExtensions.cs
Expand Up @@ -12,7 +12,7 @@ namespace TinyCsvParser
{
public static class CsvParserExtensions
{
public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromFile<TEntity>(this CsvParser<TEntity> csvParser, string fileName, Encoding encoding)
public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromFile<TEntity>(this ICsvParser<TEntity> csvParser, string fileName, Encoding encoding)
{
if (fileName == null)
{
Expand All @@ -26,7 +26,7 @@ public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromFile<TEntity>(thi
return csvParser.Parse(lines);
}

public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromString<TEntity>(this CsvParser<TEntity> csvParser, CsvReaderOptions csvReaderOptions, string csvData)
public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromString<TEntity>(this ICsvParser<TEntity> csvParser, CsvReaderOptions csvReaderOptions, string csvData)
{
var lines = csvData
.Split(csvReaderOptions.NewLine, StringSplitOptions.None)
Expand All @@ -46,7 +46,7 @@ private static IEnumerable<string> ReadLinesFromStream(Stream stream, Encoding e
}
}

public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromStream<TEntity>(this CsvParser<TEntity> csvParser, Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks = false, int bufferSize = 1024, bool leaveOpen = false)
public static ParallelQuery<CsvMappingResult<TEntity>> ReadFromStream<TEntity>(this ICsvParser<TEntity> csvParser, Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks = false, int bufferSize = 1024, bool leaveOpen = false)
{
if (stream == null)
{
Expand Down
6 changes: 3 additions & 3 deletions TinyCsvParser/TinyCsvParser/TinyCsvParser.csproj
Expand Up @@ -12,10 +12,10 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Copyright © 2021 Philipp Wagner</Copyright>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyVersion>2.6.2.0</AssemblyVersion>
<FileVersion>2.6.2.0</FileVersion>
<AssemblyVersion>2.7.0.0</AssemblyVersion>
<FileVersion>2.7.0.0</FileVersion>
<RepositoryType>git</RepositoryType>
<Version>2.6.2</Version>
<Version>2.7.0</Version>
<IncludeSource>True</IncludeSource>
<IncludeSymbols>True</IncludeSymbols>
<SignAssembly>true</SignAssembly>
Expand Down

0 comments on commit 1ebf317

Please sign in to comment.