Skip to content

Commit

Permalink
Merge pull request #139 from pfpack/release/2.2.0-preview.9_optional
Browse files Browse the repository at this point in the history
release/v2.2.0-preview.9_optional
  • Loading branch information
andreise authored Feb 14, 2024
2 parents e5cff55 + 9a8359c commit 0738528
Show file tree
Hide file tree
Showing 120 changed files with 696 additions and 728 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ jobs:
- name: Pack Optional
run: dotnet pack ./src/*/*/Optional.csproj --no-restore -o ~/nuget -c Release

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

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

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

Expand Down
13 changes: 5 additions & 8 deletions src/core-taggeds-failure/Failure.Tests/Failure.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Failure\Failure.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="DeepEqual" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="PrimeFuncPack.UnitTest.Data" Version="3.1.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Failure\Failure.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,13 +8,13 @@ partial class AbsentStaticTestsBase<T>
public void Comparison_Compare_OfAndDefault_ExpectTrue()
{
var actual = Absent.Compare(Absent.Of<T>(), default(Absent<T>));
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_Compare_OfAndNew_ExpectTrue()
{
var actual = Absent.Compare(new Absent<T>(), default(Absent<T>));
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,13 +8,13 @@ partial class AbsentStaticTestsBase<T>
public void Equality_Equals_OfAndDefault_ExpectTrue()
{
var actual = Absent.Equals(Absent.Of<T>(), default(Absent<T>));
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Equals_OfAndNew_ExpectTrue()
{
var actual = Absent.Equals(Absent.Of<T>(), new Absent<T>());
Assert.True(actual);
Assert.That(actual, Is.True);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -8,18 +7,18 @@ partial class AbsentStaticTestsBase<T>
[Test]
public void Factory_Of_ExpectEqualToDefault()
{
Assert.AreEqual(default(Absent<T>), Absent.Of<T>());
Assert.That(Absent.Of<T>(), Is.EqualTo(default(Absent<T>)));
}

[Test]
public void Factory_Of_ExpectEqualToNew()
{
Assert.AreEqual(new Absent<T>(), Absent.Of<T>());
Assert.That(Absent.Of<T>(), Is.EqualTo(new Absent<T>()));
}

[Test]
public void Factory_Of_ExpectEqualToValue()
{
Assert.AreEqual(Absent<T>.Value, Absent.Of<T>());
Assert.That(Absent.Of<T>(), Is.EqualTo(Absent<T>.Value));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,69 +8,69 @@ partial class AbsentTestsBase<T>
public void Comparison_Compare_NewAndDefault_ExpectZero()
{
var actual = Absent<T>.Compare(new Absent<T>(), default);
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_Compare_ValueAndDefault_ExpectZero()
{
var actual = Absent<T>.Compare(Absent<T>.Value, default);
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_LessThanOrEqualToOperator_NewAndDefault_ExpectTrue()
{
var actual = new Absent<T>() <= default(Absent<T>);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Comparison_LessThanOrEqualToOperator_ValueAndDefault_ExpectTrue()
{
var actual = Absent<T>.Value <= default(Absent<T>);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Comparison_GreaterThanOrEqualToOperator_NewAndDefault_ExpectTrue()
{
var actual = new Absent<T>() >= default(Absent<T>);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Comparison_GreaterThanOrEqualToOperator_ValueAndDefault_ExpectTrue()
{
var actual = Absent<T>.Value >= default(Absent<T>);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Comparison_LessThanOperator_NewAndDefault_ExpectFalse()
{
var actual = new Absent<T>() < default(Absent<T>);
Assert.False(actual);
Assert.That(actual, Is.False);
}

[Test]
public void Comparison_LessThanOperator_ValueAndDefault_ExpectFalse()
{
var actual = Absent<T>.Value < default(Absent<T>);
Assert.False(actual);
Assert.That(actual, Is.False);
}

[Test]
public void Comparison_GreaterThanOperator_NewAndDefault_ExpectFalse()
{
var actual = new Absent<T>() > default(Absent<T>);
Assert.False(actual);
Assert.That(actual, Is.False);
}

[Test]
public void Comparison_GreaterThanOperator_ValueAndDefault_ExpectFalse()
{
var actual = Absent<T>.Value > default(Absent<T>);
Assert.False(actual);
Assert.That(actual, Is.False);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,44 +8,44 @@ partial class AbsentTestsBase<T>
public void Comparison_CompareTo_NewAndDefault_ExpectZero()
{
var actual = new Absent<T>().CompareTo(default);
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_CompareTo_ValueAndDefault_ExpectZero()
{
var actual = Absent<T>.Value.CompareTo(default);
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_CompareToObj_NewAndNull_ExpectOne()
{
var actual = new Absent<T>().CompareTo(null);
Assert.Positive(actual);
Assert.AreEqual(1, actual);
Assert.That(actual, Is.Positive);
Assert.That(actual, Is.EqualTo(1));
}

[Test]
public void Comparison_CompareToObj_ValueAndNull_ExpectOne()
{
var actual = Absent<T>.Value.CompareTo(null);
Assert.Positive(actual);
Assert.AreEqual(1, actual);
Assert.That(actual, Is.Positive);
Assert.That(actual, Is.EqualTo(1));
}

[Test]
public void Comparison_CompareToObj_NewAndDefault_ExpectZero()
{
var actual = new Absent<T>().CompareTo((object?)default(Absent<T>));
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
public void Comparison_CompareToObj_ValueAndDefault_ExpectZero()
{
var actual = Absent<T>.Value.CompareTo((object?)new Absent<T>());
Assert.Zero(actual);
Assert.That(actual, Is.Zero);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,41 +8,41 @@ partial class AbsentTestsBase<T>
public void Equality_Static_Equals_NewAndDefault_ExpectTrue()
{
var actual = Absent<T>.Equals(new Absent<T>(), default);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Static_Equals_ValueAndDefault_ExpectTrue()
{
var actual = Absent<T>.Equals(Absent<T>.Value, default);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Static_EqualityOperator_NewAndDefault_ExpectTrue()
{
var actual = new Absent<T>() == default;
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Static_EqualityOperator_ValueAndDefault_ExpectTrue()
{
var actual = Absent<T>.Value == default;
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Static_InequalityOperator_NewAndDefault_ExpectFalse()
{
var actual = new Absent<T>() != default;
Assert.False(actual);
Assert.That(actual, Is.False);
}

[Test]
public void Equality_Static_InequalityOperator_ValueAndDefault_ExpectFalse()
{
var actual = Absent<T>.Value != default;
Assert.False(actual);
Assert.That(actual, Is.False);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -9,13 +8,13 @@ partial class AbsentTestsBase<T>
public void Equality_Equals_NewAndDefault_ExpectTrue()
{
var actual = new Absent<T>().Equals(default);
Assert.True(actual);
Assert.That(actual, Is.True);
}

[Test]
public void Equality_Equals_ValueAndDefault_ExpectTrue()
{
var actual = Absent<T>.Value.Equals(default);
Assert.True(actual);
Assert.That(actual, Is.True);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using NUnit.Framework;
using System;
using System;

namespace PrimeFuncPack.Core.Tests;

Expand All @@ -8,12 +7,12 @@ partial class AbsentTestsBase<T>
[Test]
public void Factory_New_ExpectDefault()
{
Assert.AreEqual(default(Absent<T>), new Absent<T>());
Assert.That(new Absent<T>(), Is.EqualTo(default(Absent<T>)));
}

[Test]
public void Factory_Value_ExpectDefault()
{
Assert.AreEqual(default(Absent<T>), Absent<T>.Value);
Assert.That(Absent<T>.Value, Is.EqualTo(default(Absent<T>)));
}
}
Loading

0 comments on commit 0738528

Please sign in to comment.