Skip to content

Commit

Permalink
Merge pull request #23 from pfpack/release/v2.0.0-preview.2.0.0
Browse files Browse the repository at this point in the history
release/v2.0.0-preview.2.0.0
  • Loading branch information
pmosk authored Sep 21, 2021
2 parents 40b07b1 + a70a873 commit 6d011c6
Show file tree
Hide file tree
Showing 88 changed files with 1,991 additions and 32 deletions.
84 changes: 73 additions & 11 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: .NET
on:
push:
branches: [ master, dev, feature/*, fix/*, release/* ]

pull_request:
branches: [ master ]

release:
types: [ published ]
branches: [ master ]
Expand All @@ -23,17 +23,85 @@ jobs:
with:
dotnet-version: 6.0.x
include-prerelease: true

# Create Local NuGet Source

- name: Create Local NuGet Directory
run: mkdir ~/nuget

- name: Add Local Nuget Source
run: dotnet nuget add source ~/nuget

# Primitives.Linq

- name: Restore Primitives.Linq
run: dotnet restore ./src/*/*/Primitives.Linq.csproj

- name: Build Primitives.Linq
run: dotnet build ./src/*/*/Primitives.Linq.csproj --no-restore -c Release

- name: Pack Primitives.Linq
run: dotnet pack ./src/*/*/Primitives.Linq.csproj --no-restore -o ~/nuget -c Release

- name: Restore Primitives.Linq.Tests
run: dotnet restore ./src/*/*/Primitives.Linq.Tests.csproj

- name: Test Primitives.Linq.Tests
run: dotnet test ./src/*/*/Primitives.Linq.Tests.csproj --no-restore -c Release

# Primitives.Pipeline

- name: Restore Primitives.Pipeline
run: dotnet restore ./src/*/*/Primitives.Pipeline.csproj

- name: Build Primitives.Pipeline
run: dotnet build ./src/*/*/Primitives.Pipeline.csproj --no-restore -c Release

- name: Pack Primitives.Pipeline
run: dotnet pack ./src/*/*/Primitives.Pipeline.csproj --no-restore -o ~/nuget -c Release

- name: Restore Primitives.Pipeline.Tests
run: dotnet restore ./src/*/*/Primitives.Pipeline.Tests.csproj

- name: Test Primitives.Pipeline.Tests
run: dotnet test ./src/*/*/Primitives.Pipeline.Tests.csproj --no-restore -c Release

# Primitives.Predicates

- name: Restore Primitives.Predicates
run: dotnet restore ./src/*/*/Primitives.Predicates.csproj

- name: Build Primitives.Predicates
run: dotnet build ./src/*/*/Primitives.Predicates.csproj --no-restore -c Release

- name: Pack Primitives.Predicates
run: dotnet pack ./src/*/*/Primitives.Predicates.csproj --no-restore -o ~/nuget -c Release

- name: Restore Primitives.Predicates.Tests
run: dotnet restore ./src/*/*/Primitives.Predicates.Tests.csproj

- name: Test Primitives.Predicates.Tests
run: dotnet test ./src/*/*/Primitives.Predicates.Tests.csproj --no-restore -c Release

# Primitives.Strings

- name: Restore Primitives.Strings
run: dotnet restore ./src/*/*/Primitives.Strings.csproj

- name: Build Primitives.Strings
run: dotnet build ./src/*/*/Primitives.Strings.csproj --no-restore -c Release

- name: Pack Primitives.Strings
run: dotnet pack ./src/*/*/Primitives.Strings.csproj --no-restore -o ~/nuget -c Release

- name: Restore Primitives.Strings.Tests
run: dotnet restore ./src/*/*/Primitives.Strings.Tests.csproj

- name: Test Primitives.Strings.Tests
run: dotnet test ./src/*/*/Primitives.Strings.Tests.csproj --no-restore -c Release

# Primitives

- name: Restore Primitives
run: dotnet restore ./src/*/*/Primitives.csproj

Expand All @@ -42,13 +110,7 @@ jobs:

- name: Pack Primitives
run: dotnet pack ./src/*/*/Primitives.csproj --no-restore -o ~/nuget -c Release

- name: Restore Primitives.Tests
run: dotnet restore ./src/*/*/Primitives.Tests.csproj

- name: Test Primitives.Tests
run: dotnet test ./src/*/*/Primitives.Tests.csproj --no-restore -c Release

# Push

- name: Push Packages
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# PrimeFuncPack Primitives
PrimeFuncPack Primitives is a core library for .NET consisting of useful extensions and predicates making work with functional pipelines, Linq, the nullable feature, etc. easier.
PrimeFuncPack Primitives is a core library for .NET consisting of useful extensions and predicates making work with functional pipelines, Linq, strings, the nullable feature, etc. easier.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<Authors>Andrei Sergeev, Pavel Moskovoy</Authors>
<Copyright>Copyright © 2020-2021 Andrei Sergeev, Pavel Moskovoy</Copyright>
<RootNamespace>PrimeFuncPack.Primitives.Tests</RootNamespace>
<AssemblyName>PrimeFuncPack.Primitives.Linq.Tests</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="PrimeFuncPack.UnitTest.Data" Version="2.0.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Primitives.Linq\Primitives.Linq.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#nullable enable

using System.Collections.Generic;
using System.Linq;
using static PrimeFuncPack.UnitTest.TestData;

namespace PrimeFuncPack.Primitives.Tests
{
internal static class ObjectTestData
{
public static IEnumerable<object?[]> NullableObjectTestSource
=>
new object?[]
{
null,
PlusFifteenIdRefType,
SomeTextStructType
}
.Select(v => new object?[] { v });
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#nullable enable

using NUnit.Framework;
using System.Linq;

namespace PrimeFuncPack.Primitives.Tests
{
partial class YieldExtensionsTest
{
[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectCollectionLengthEqualsOne(
object? sourceValue)
{
var actual = sourceValue.YieldSingle();

var actualLength = actual.Count();
Assert.AreEqual(1, actualLength);
}

[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectFirstItemIsSameAsSourceValue(
object? sourceValue)
{
var actual = sourceValue.YieldSingle();

var actualFirst = actual.FirstOrDefault();
Assert.AreSame(sourceValue, actualFirst);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#nullable enable

namespace PrimeFuncPack.Primitives.Tests
{
public sealed partial class YieldExtensionsTest
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#nullable enable

using NUnit.Framework;
using PrimeFuncPack.UnitTest;
using System.Linq;

namespace PrimeFuncPack.Primitives.Tests
{
partial class YielderTest
{
[Test]
public void YieldEmpty_ExpectEmptyCollection()
{
var actual = Yielder.YieldEmpty<StructType?>();
Assert.IsEmpty(actual);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#nullable enable

using NUnit.Framework;
using System.Linq;

namespace PrimeFuncPack.Primitives.Tests
{
partial class YielderTest
{
[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectCollectionLengthEqualsOne(
object? sourceValue)
{
var actual = Yielder.YieldSingle(sourceValue);

var actualLength = actual.Count();
Assert.AreEqual(1, actualLength);
}

[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectFirstItemIsSameAsSourceValue(
object? sourceValue)
{
var actual = Yielder.YieldSingle(sourceValue);

var actualFirst = actual.FirstOrDefault();
Assert.AreSame(sourceValue, actualFirst);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#nullable enable

namespace PrimeFuncPack.Primitives.Tests
{
public sealed partial class YielderTest
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#nullable enable

using NUnit.Framework;
using PrimeFuncPack.UnitTest;
using System.Linq;

namespace PrimeFuncPack.Primitives.Tests
{
partial class YielderTypedTest
{
[Test]
public void YieldEmpty_ExpectEmptyCollection()
{
var actual = Yielder<StructType?>.YieldEmpty();
Assert.IsEmpty(actual);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#nullable enable

using NUnit.Framework;
using System.Linq;

namespace PrimeFuncPack.Primitives.Tests
{
partial class YielderTypedTest
{
[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectCollectionLengthEqualsOne(
object? sourceValue)
{
var actual = Yielder<object?>.YieldSingle(sourceValue);

var actualLength = actual.Count();
Assert.AreEqual(1, actualLength);
}

[Test]
[TestCaseSource(typeof(ObjectTestData), nameof(ObjectTestData.NullableObjectTestSource))]
public void YieldSingle_ExpectFirstItemIsSameAsSourceValue(
object? sourceValue)
{
var actual = Yielder<object?>.YieldSingle(sourceValue);

var actualFirst = actual.FirstOrDefault();
Assert.AreSame(sourceValue, actualFirst);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#nullable enable

namespace PrimeFuncPack.Primitives.Tests
{
public sealed partial class YielderTypedTest
{
}
}
26 changes: 26 additions & 0 deletions src/primitives-linq/Primitives.Linq/Primitives.Linq.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Authors>Andrei Sergeev, Pavel Moskovoy</Authors>
<Copyright>Copyright © 2020-2021 Andrei Sergeev, Pavel Moskovoy</Copyright>
<Description>PrimeFuncPack Primitives.Linq is a core library for .NET consisting of useful extensions making work with Linq easier.</Description>
<RootNamespace>System</RootNamespace>
<AssemblyName>PrimeFuncPack.Primitives.Linq</AssemblyName>
<Version>2.0.0-preview.2.0.0</Version>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\..\LICENSE">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#nullable enable

using NUnit.Framework;
using System;

namespace PrimeFuncPack.Primitives.Tests
{
partial class PipelineTests
{
[Test]
[TestCaseSource(nameof(ValueTestSource))]
public void Pipe_ExpectSourceValue(
object? sourceValue)
{
var actual = Pipeline.Pipe(sourceValue);
Assert.AreSame(sourceValue, actual);
}
}
}
Loading

0 comments on commit 6d011c6

Please sign in to comment.