Skip to content

Commit

Permalink
Merge pull request #25 from FrendsPlatform/issue-22
Browse files Browse the repository at this point in the history
CSV.Parse - Changed Jtoken result object type to dynamic and documentation fixes
  • Loading branch information
Svenskapojkarna authored Nov 29, 2023
2 parents fea3489 + ad55aa5 commit 006ae5d
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 69 deletions.
4 changes: 4 additions & 0 deletions Frends.CSV.Parse/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.1.2] - 2023-11-28
### Fixed
- Fixed documentational issues and changed Jtoken result object type to dynamic.

## [1.1.1] - 2023-11-23
### Fixed
- Fixed issue with inverted Trim option by inverting the if statement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;

namespace Frends.CSV.Parse.UnitTests;
namespace Frends.CSV.Parse.Tests;

[TestClass]
public class UnitTests
Expand Down Expand Up @@ -271,27 +271,17 @@ public void TestParseTreatMissingFieldsAsNullSetToTrueNoHeaderWithColumnSpecific
TreatMissingFieldsAsNulls = true
};

// The boxed type cannot be checked against Nullable<T> so to make sure no exception gets
// thrown when TreatMissingFieldsAsNulls is set to true have to check if exception is thrown
// when trying to insert empty values in the data
try
{
var result = CSV.Parse(input, options, default);
var resultData = result.Data;
var itemArray = resultData[1];

Assert.IsNull(itemArray[1]);
Assert.IsNull(itemArray[2]);
Assert.IsNull(itemArray[3]);
Assert.IsNull(itemArray[4]);
Assert.IsNull(itemArray[5]);
Assert.IsNull(itemArray[6]);
Assert.IsNull(itemArray[7]);
}
catch (Exception)
{
Assert.Fail("Should not throw an exception");
}
var result = CSV.Parse(input, options, default);
var resultData = result.Data;
var itemArray = resultData[1];

Assert.IsNull(itemArray[1]);
Assert.IsNull(itemArray[2]);
Assert.IsNull(itemArray[3]);
Assert.IsNull(itemArray[4]);
Assert.IsNull(itemArray[5]);
Assert.IsNull(itemArray[6]);
Assert.IsNull(itemArray[7]);
}

[TestMethod]
Expand Down
80 changes: 40 additions & 40 deletions Frends.CSV.Parse/Frends.CSV.Parse.sln
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32319.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.CSV.Parse", "Frends.CSV.Parse\Frends.CSV.Parse.csproj", "{35C305C0-8108-4A98-BB1D-AFE5C926239E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{78F7F22E-6E20-4BCE-8362-0C558568B729}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
..\.github\workflows\Create_build_and_test_on_main.yml = ..\.github\workflows\Create_build_and_test_on_main.yml
..\.github\workflows\Create_build_and_test_on_push.yml = ..\.github\workflows\Create_build_and_test_on_push.yml
..\.github\workflows\Create_release.yml = ..\.github\workflows\Create_release.yml
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frends.CSV.Parse.UnitTests", "Frends.CSV.Parse.UnitTests\Frends.CSV.Parse.UnitTests.csproj", "{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.Build.0 = Release|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8986D685-9988-4F5F-B8D9-E42A4E44BFED}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32319.34
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.CSV.Parse", "Frends.CSV.Parse\Frends.CSV.Parse.csproj", "{35C305C0-8108-4A98-BB1D-AFE5C926239E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{78F7F22E-6E20-4BCE-8362-0C558568B729}"
ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md
..\.github\workflows\Create_build_and_test_on_main.yml = ..\.github\workflows\Create_build_and_test_on_main.yml
..\.github\workflows\Create_build_and_test_on_push.yml = ..\.github\workflows\Create_build_and_test_on_push.yml
..\.github\workflows\Create_release.yml = ..\.github\workflows\Create_release.yml
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frends.CSV.Parse.Tests", "Frends.CSV.Parse.Tests\Frends.CSV.Parse.Tests.csproj", "{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35C305C0-8108-4A98-BB1D-AFE5C926239E}.Release|Any CPU.Build.0 = Release|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01BD39F5-AAAB-47BA-A6F8-41A892532D1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8986D685-9988-4F5F-B8D9-E42A4E44BFED}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Frends.CSV.Parse/Frends.CSV.Parse/Definitions/Result.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Result
/// Result as JToken.
/// </summary>
/// <example>{[ {"value": "1", "foos": "foo", "bars": "bar"} ]}</example>
public object Jtoken { get; private set; }
public dynamic Jtoken { get; private set; }

/// <summary>
/// Result as XML.
Expand Down
6 changes: 3 additions & 3 deletions Frends.CSV.Parse/Frends.CSV.Parse/Frends.CSV.Parse.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Frends</Authors>
<Copyright>Frends</Copyright>
<Company>Frends</Company>
<Product>Frends</Product>
<PackageTags>Frends</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>Frends Task to parse string CSV content to a object.</Description>
<Description>Frends Task for parsing CSV string.</Description>
<PackageProjectUrl>https://frends.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/FrendsPlatform/Frends.CSV</RepositoryUrl>
<RepositoryUrl>https://github.com/FrendsPlatform/Frends.CSV2/tree/main/Frends.CSV.Parse</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Frends.CSV.Parse/Frends.CSV.Parse/Parse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Frends.CSV.Parse;
public class CSV
{
/// <summary>
/// Parse string CSV content to an object.
/// Frends Task for parsing CSV string.
/// [Documentation](https://tasks.frends.com/tasks/frends-tasks/Frends.CSV.Parse)
/// </summary>
/// <param name="input">Input parameters</param>
Expand Down
4 changes: 2 additions & 2 deletions Frends.CSV.Parse/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Frends.CSV.Parse
Frends Task to parse string CSV content to a object.
Frends Task to parse CSV string to an object.

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Build](https://github.com/FrendsPlatform/Frends.CSV2/actions/workflows/Parse_build_and_test_on_main.yml/badge.svg)](https://github.com/FrendsPlatform/Frends.CSV/actions)
[![Build](https://github.com/FrendsPlatform/Frends.CSV2/actions/workflows/Parse_build_and_test_on_main.yml/badge.svg)](https://github.com/FrendsPlatform/Frends.CSV2/actions)
![Coverage](https://app-github-custom-badges.azurewebsites.net/Badge?key=FrendsPlatform/Frends.CSV2/Frends.CSV.Parse|main)

# Installing
Expand Down

0 comments on commit 006ae5d

Please sign in to comment.