Skip to content

Commit d43623a

Browse files
author
Brian
committed
Introduced Outcomes.Composer, an experimental flow control tool powered by Outcomes.
- Don't worry: composer will be a seperate nugit package to keep things clean. - Added a new constructor to OutcomeResult to enable Composer. - Added some rudimentary tests for Composer. - Added ShowInternals to Outcomes (for now). - Superficial housekeeping in Outcomes. - Bumped Outcomes to 2.5-alpha for this.
1 parent e4852ec commit d43623a

File tree

14 files changed

+696
-37
lines changed

14 files changed

+696
-37
lines changed

.gitignore

Lines changed: 148 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,52 @@
1-
# Build and Object Folders
2-
bin/
3-
obj/
4-
5-
#User Specific Files
6-
*.user
7-
*.suo
81
## Ignore Visual Studio temporary files, build results, and
92
## files generated by popular Visual Studio add-ons.
3+
104
# User-specific files
5+
*.suo
6+
*.user
7+
*.userosscache
118
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
1213
# Build results
1314
[Dd]ebug/
15+
[Dd]ebugPublic/
1416
[Rr]elease/
17+
[Rr]eleases/
1518
x64/
19+
x86/
20+
build/
21+
bld/
22+
[Bb]in/
23+
[Oo]bj/
24+
25+
# Visual Studio 2015 cache/options directory
26+
.vs/
27+
# Uncomment if you have tasks that create the project's static files in wwwroot
28+
#wwwroot/
29+
30+
# MSTest test Results
31+
[Tt]est[Rr]esult*/
32+
[Bb]uild[Ll]og.*
33+
34+
# NUNIT
35+
*.VisualState.xml
36+
TestResult.xml
37+
38+
# Build Results of an ATL Project
39+
[Dd]ebugPS/
40+
[Rr]eleasePS/
41+
dlldata.c
42+
43+
# DNX
44+
project.lock.json
45+
artifacts/
46+
1647
*_i.c
1748
*_p.c
49+
*_i.h
1850
*.ilk
1951
*.meta
2052
*.obj
@@ -28,29 +60,66 @@ x64/
2860
*.tli
2961
*.tlh
3062
*.tmp
63+
*.tmp_proj
3164
*.log
3265
*.vspscc
3366
*.vssscc
3467
.builds
68+
*.pidb
69+
*.svclog
70+
*.scc
71+
72+
# Chutzpah Test files
73+
_Chutzpah*
74+
3575
# Visual C++ cache files
3676
ipch/
3777
*.aps
3878
*.ncb
3979
*.opensdf
4080
*.sdf
81+
*.cachefile
82+
4183
# Visual Studio profiler
4284
*.psess
4385
*.vsp
4486
*.vspx
87+
88+
# TFS 2012 Local Workspace
89+
$tf/
90+
4591
# Guidance Automation Toolkit
4692
*.gpState
93+
4794
# ReSharper is a .NET coding add-in
48-
_ReSharper*
95+
_ReSharper*/
96+
*.[Rr]e[Ss]harper
97+
*.DotSettings.user
98+
99+
# JustCode is a .NET coding add-in
100+
.JustCode
101+
102+
# TeamCity is a build add-in
103+
_TeamCity*
104+
105+
# DotCover is a Code Coverage Tool
106+
*.dotCover
107+
49108
# NCrunch
50-
*.ncrunch*
109+
_NCrunch_*
51110
.*crunch*.local.xml
52-
# Installshield output folder
53-
[Ee]xpress
111+
nCrunchTemp_*
112+
113+
# MightyMoose
114+
*.mm.*
115+
AutoTest.Net/
116+
117+
# Web workbench (sass)
118+
.sass-cache/
119+
120+
# Installshield output folder
121+
[Ee]xpress/
122+
54123
# DocProject is a documentation generator add-in
55124
DocProject/buildhelp/
56125
DocProject/Help/*.HxT
@@ -60,30 +129,80 @@ DocProject/Help/*.hhk
60129
DocProject/Help/*.hhp
61130
DocProject/Help/Html2
62131
DocProject/Help/html
132+
63133
# Click-Once directory
64-
publish
134+
publish/
135+
65136
# Publish Web Output
66-
*.Publish.xml
137+
*.[Pp]ublish.xml
138+
*.azurePubxml
139+
# TODO: Comment the next line if you want to checkin your web deploy settings
140+
# but database connection strings (with potential passwords) will be unencrypted
141+
#*.pubxml
142+
*.publishproj
143+
144+
# NuGet Packages
145+
*.nupkg
146+
# The packages folder can be ignored because of Package Restore
147+
**/packages/*
148+
# except build/, which is used as an MSBuild target.
149+
!**/packages/build/
150+
# Uncomment if necessary however generally it will be regenerated when needed
151+
#!**/packages/repositories.config
152+
153+
# Windows Azure Build Output
154+
csx/
155+
*.build.csdef
156+
157+
# Windows Store app package directory
158+
AppPackages/
159+
160+
# Visual Studio cache files
161+
# files ending in .cache can be ignored
162+
*.[Cc]ache
163+
# but keep track of directories ending in .cache
164+
!*.[Cc]ache/
165+
67166
# Others
68-
[Bb]in
69-
[Oo]bj
70-
sql
71-
TestResults
72-
[Tt]est[Rr]esult*
73-
*.Cache
74-
ClientBin
167+
ClientBin/
75168
[Ss]tyle[Cc]op.*
76169
~$*
170+
*~
77171
*.dbmdl
78-
Generated_Code #added for RIA/Silverlight projects
79-
# Backup & report files from converting an old project file to a newer
80-
# Visual Studio version. Backup files are not needed, because we have git ;-)
172+
*.dbproj.schemaview
173+
*.pfx
174+
*.publishsettings
175+
node_modules/
176+
orleans.codegen.cs
177+
178+
# RIA/Silverlight projects
179+
Generated_Code/
180+
181+
# Backup & report files from converting an old project file
182+
# to a newer Visual Studio version. Backup files are not needed,
183+
# because we have git ;-)
81184
_UpgradeReport_Files/
82185
Backup*/
83-
UpgradeLog.htm
84-
UpgradeLog.XML
186+
UpgradeLog*.XML
187+
UpgradeLog*.htm
188+
189+
# SQL Server files
190+
*.mdf
191+
*.ldf
192+
193+
# Business Intelligence projects
194+
*.rdl.data
195+
*.bim.layout
196+
*.bim_*.settings
197+
198+
# Microsoft Fakes
199+
FakesAssemblies/
200+
201+
# Node.js Tools for Visual Studio
202+
.ntvs_analysis.dat
203+
204+
# Visual Studio 6 build log
205+
*.plg
85206

86-
# Packages
87-
nuget.exe
88-
Source/packages/*
89-
!Source/packages/repositories.config
207+
# Visual Studio 6 workspace options file
208+
*.opt
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using Ether.Outcomes.Composer.Tests.Helpers;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
4+
namespace Ether.Outcomes.Composer.Tests
5+
{
6+
[TestClass]
7+
public class ComposerTests
8+
{
9+
[TestMethod]
10+
public void ComposerBasics()
11+
{
12+
var outcome = Composer.Execute<string>(StaticHelpers.Success);
13+
14+
Assert.IsTrue(outcome.Success);
15+
}
16+
17+
[TestMethod]
18+
public void OnSuccessTest()
19+
{
20+
var outcome = Composer.Execute<string>(StaticHelpers.Fail)
21+
.IfFailure(StaticHelpers.Success);
22+
23+
Assert.IsTrue(outcome.Success);
24+
}
25+
26+
[TestMethod]
27+
public void OnFailureTest()
28+
{
29+
var result = Composer.Execute<string>(StaticHelpers.Fail)
30+
.BreakIf(outcome => outcome.Failure)
31+
.IfSuccess(outcome => Outcomes.Success<string>()); //should not fire
32+
33+
Assert.IsTrue(result.Failure);
34+
}
35+
36+
[TestMethod]
37+
public void IfTest()
38+
{
39+
var result = Composer.Execute<string>(StaticHelpers.Fail)
40+
.If(outcome => outcome.Failure, Outcomes.Success<string>)
41+
.IfSuccess(outcome => Outcomes.Success<string>()); //should not fire
42+
43+
Assert.IsTrue(result.Success);
44+
}
45+
}
46+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{9EBD9B53-0608-481C-A94D-7D3D4BEC8F03}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>Ether.Outcomes.Composer.Tests</RootNamespace>
10+
<AssemblyName>Ether.Outcomes.Composer.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>DEBUG;TRACE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="System" />
39+
</ItemGroup>
40+
<Choose>
41+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
42+
<ItemGroup>
43+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
44+
</ItemGroup>
45+
</When>
46+
<Otherwise>
47+
<ItemGroup>
48+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
49+
</ItemGroup>
50+
</Otherwise>
51+
</Choose>
52+
<ItemGroup>
53+
<Compile Include="Helpers\StaticHelpers.cs" />
54+
<Compile Include="ComposerTests.cs" />
55+
<Compile Include="Properties\AssemblyInfo.cs" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<ProjectReference Include="..\Outcomes.Composer\Ether.Outcomes.Composer.csproj">
59+
<Project>{fd7adda5-9c68-451e-9551-2f1b988a36c8}</Project>
60+
<Name>Ether.Outcomes.Composer</Name>
61+
</ProjectReference>
62+
<ProjectReference Include="..\Outcomes\Ether.Outcomes.csproj">
63+
<Project>{5e8758eb-ed8b-4f86-9176-4b10c50da8be}</Project>
64+
<Name>Ether.Outcomes</Name>
65+
</ProjectReference>
66+
</ItemGroup>
67+
<ItemGroup>
68+
<None Include="packages.config" />
69+
</ItemGroup>
70+
<Choose>
71+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
72+
<ItemGroup>
73+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
74+
<Private>False</Private>
75+
</Reference>
76+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
77+
<Private>False</Private>
78+
</Reference>
79+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
80+
<Private>False</Private>
81+
</Reference>
82+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
83+
<Private>False</Private>
84+
</Reference>
85+
</ItemGroup>
86+
</When>
87+
</Choose>
88+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
89+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
90+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
91+
Other similar extension points exist, see Microsoft.Common.targets.
92+
<Target Name="BeforeBuild">
93+
</Target>
94+
<Target Name="AfterBuild">
95+
</Target>
96+
-->
97+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace Ether.Outcomes.Composer.Tests.Helpers
2+
{
3+
public static class StaticHelpers
4+
{
5+
public static IOutcome<string> Success()
6+
{
7+
return Outcomes.Success<string>();
8+
}
9+
10+
public static IOutcome<string> Fail()
11+
{
12+
return Outcomes.Failure<string>();
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)