Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/v2.2.0-preview.9_optional #139

Merged
merged 8 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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