Skip to content

Commit

Permalink
added FluentResultsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-w4tch3r committed Dec 27, 2023
1 parent 10f8ccf commit 8f58115
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
15 changes: 15 additions & 0 deletions FluentResultsTest/FluentResultsTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>12</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentResults" Version="3.15.2" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions FluentResultsTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// See https://aka.ms/new-console-template for more information

using FluentResults;

var action = new Action(() => throw new Exception("test"));
var result = Result.Try(action);

var worker = new Worker();
var result2 = Result.Try(worker.DoWork);

result.WithErrors(result2.Errors)
.WithError($"error {new List<int> {1, 2, 3}}");

Console.WriteLine(result);

public class Worker
{
public void DoWork()
{
throw new NotImplementedException();
}
}
6 changes: 6 additions & 0 deletions Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DryIocTest", "DryIocTest\Dr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZxingQrTest", "ZxingQrTest\ZxingQrTest.csproj", "{D2967CE3-CE36-4BEA-967C-5156A1081C13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentResultsTest", "FluentResultsTest\FluentResultsTest.csproj", "{90C3FF9F-295D-40C3-98CC-72BECD4453EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,5 +26,9 @@ Global
{D2967CE3-CE36-4BEA-967C-5156A1081C13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2967CE3-CE36-4BEA-967C-5156A1081C13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2967CE3-CE36-4BEA-967C-5156A1081C13}.Release|Any CPU.Build.0 = Release|Any CPU
{90C3FF9F-295D-40C3-98CC-72BECD4453EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90C3FF9F-295D-40C3-98CC-72BECD4453EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90C3FF9F-295D-40C3-98CC-72BECD4453EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90C3FF9F-295D-40C3-98CC-72BECD4453EC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

0 comments on commit 8f58115

Please sign in to comment.