Skip to content

Commit

Permalink
reorganise solution (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsoulavy committed Jan 21, 2022
1 parent d722fe6 commit ca9a09a
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 262 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
- name: Restore dependencies
run: dotnet restore
- name: Create NuGet Package
run: dotnet pack -c Release /p:Version=${{ github.event.release.tag_name }} /p:PackageReleaseNotes="See https://github.com/late4dtrain/functional-result/releases/tag/${{ github.event.release.tag_name }}"
run: dotnet pack -c Release /p:Version=${{ github.event.release.tag_name }} /p:PackageReleaseNotes="See https://github.com/late4dtrain/result/releases/tag/${{ github.event.release.tag_name }}"
- name: Archive NuGet Package
uses: actions/upload-artifact@v1
with:
name: Result
path: ./Late4dTrain.Functional.Result/bin/Release/Late4dTrain.Functional.Result.${{ github.event.release.tag_name }}.nupkg
path: ./Late4dTrain.Result/bin/Release/Late4dTrain.Result.${{ github.event.release.tag_name }}.nupkg

- name: Publish NuGet Package
run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
60 changes: 30 additions & 30 deletions ...ate4dTrain.Functional.Result.Tests.csproj → ...ult.Tests/Late4dTrain.Result.Tests.csproj
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<RootNamespace>Late4dTrain.Functional.ResultTests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Late4dTrain.Functional.Result\Late4dTrain.Functional.Result.csproj" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<RootNamespace>Late4dTrain</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Late4dTrain.Result\Late4dTrain.Result.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
namespace Late4dTrain.Functional.ResultTests;

using System;

using FluentAssertions;

using Xunit;

public class OnFailTests
{
[Fact]
public void OnFailWithIntResult()
{
var successCalled = false;
var failCalled = false;
var capturedError = string.Empty;

var result = Result<string>.Fail<int>("It went wrong...");
var func = () => result.Value;

result
.OnSuccess((i) => successCalled = true)
.OnFailure((e) =>
{
failCalled = true;
capturedError = e;
}
);

successCalled.Should().BeFalse();
failCalled.Should().BeTrue();
result.Error.Should().Be("It went wrong...");
capturedError.Should().Be("It went wrong...");
func.Should().Throw<InvalidOperationException>();
}

[Fact]
public void OnFailWithoutResult()
{
var successCalled = false;
var failCalled = false;
var capturedError = string.Empty;

var result = Result<string>.Fail("It went wrong...");

result
.OnSuccess(() => successCalled = true)
.OnFailure((e) =>
{
failCalled = true;
capturedError = e;
}
);

successCalled.Should().BeFalse();
failCalled.Should().BeTrue();
result.Error.Should().Be("It went wrong...");
capturedError.Should().Be("It went wrong...");
}

}
namespace Late4dTrain;

using System;

using FluentAssertions;

using Xunit;

public class OnFailTests
{
[Fact]
public void OnFailWithIntResult()
{
var successCalled = false;
var failCalled = false;
var capturedError = string.Empty;

var result = Result<string>.Fail<int>("It went wrong...");
var func = () => result.Value;

result
.OnSuccess((i) => successCalled = true)
.OnFailure((e) =>
{
failCalled = true;
capturedError = e;
}
);

successCalled.Should().BeFalse();
failCalled.Should().BeTrue();
result.Error.Should().Be("It went wrong...");
capturedError.Should().Be("It went wrong...");
func.Should().Throw<InvalidOperationException>();
}

[Fact]
public void OnFailWithoutResult()
{
var successCalled = false;
var failCalled = false;
var capturedError = string.Empty;

var result = Result<string>.Fail("It went wrong...");

result
.OnSuccess(() => successCalled = true)
.OnFailure((e) =>
{
failCalled = true;
capturedError = e;
}
);

successCalled.Should().BeFalse();
failCalled.Should().BeTrue();
result.Error.Should().Be("It went wrong...");
capturedError.Should().Be("It went wrong...");
}

}
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
namespace Late4dTrain.Functional.ResultTests;

using System;

using FluentAssertions;

using Xunit;

public class OnSuccessTests
{
[Fact]
public void OnSuccessWithIntResult()
{
var successCalled = false;
var failCalled = false;
var capturedResult = 0;

var result = Result<string>.Ok(42);
var func = () => result.Error;

result
.OnSuccess((i) =>
{
successCalled = true;
capturedResult = i;
}
)
.OnFailure((e) => failCalled = true);

successCalled.Should().BeTrue();
failCalled.Should().BeFalse();
result.Value.Should().Be(42);
capturedResult.Should().Be(42);
func.Should().Throw<InvalidOperationException>();
}

[Fact]
public void OnSuccessWithoutResult()
{
var successCalled = false;
var failCalled = false;

var result = Result<string>.Ok();
var func = () => result.Error;

result
.OnSuccess(() => successCalled = true)
.OnFailure((e) => failCalled = true);

successCalled.Should().BeTrue();
failCalled.Should().BeFalse();

func.Should().Throw<InvalidOperationException>();
}
}
namespace Late4dTrain;

using System;

using FluentAssertions;

using Xunit;

public class OnSuccessTests
{
[Fact]
public void OnSuccessWithIntResult()
{
var successCalled = false;
var failCalled = false;
var capturedResult = 0;

var result = Result<string>.Ok(42);
var func = () => result.Error;

result
.OnSuccess((i) =>
{
successCalled = true;
capturedResult = i;
}
)
.OnFailure((e) => failCalled = true);

successCalled.Should().BeTrue();
failCalled.Should().BeFalse();
result.Value.Should().Be(42);
capturedResult.Should().Be(42);
func.Should().Throw<InvalidOperationException>();
}

[Fact]
public void OnSuccessWithoutResult()
{
var successCalled = false;
var failCalled = false;

var result = Result<string>.Ok();
var func = () => result.Error;

result
.OnSuccess(() => successCalled = true)
.OnFailure((e) => failCalled = true);

successCalled.Should().BeTrue();
failCalled.Should().BeFalse();

func.Should().Throw<InvalidOperationException>();
}
}
44 changes: 22 additions & 22 deletions Late4dTrain.Functional.sln → Late4dTrain.Result.sln
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Late4dTrain.Functional.Result", "Late4dTrain.Functional.Result\Late4dTrain.Functional.Result.csproj", "{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Late4dTrain.Functional.Result.Tests", "Late4dTrain.Functional.Result.Tests\Late4dTrain.Functional.Result.Tests.csproj", "{4AF544CA-A934-4853-911A-DB9E481CA52B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Release|Any CPU.Build.0 = Release|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Late4dTrain.Result", "Late4dTrain.Result\Late4dTrain.Result.csproj", "{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Late4dTrain.Result.Tests", "Late4dTrain.Result.Tests\Late4dTrain.Result.Tests.csproj", "{4AF544CA-A934-4853-911A-DB9E481CA52B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD4BBABF-A9D3-4880-895C-9F7CAEC8EB4F}.Release|Any CPU.Build.0 = Release|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4AF544CA-A934-4853-911A-DB9E481CA52B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading

0 comments on commit ca9a09a

Please sign in to comment.