Skip to content

Commit 7cdf7f0

Browse files
author
Brian
committed
Final checkin for improving directory structure.
1 parent 58acf03 commit 7cdf7f0

11 files changed

+494
-0
lines changed

.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Build and Object Folders
2+
bin/
3+
obj/
4+
5+
#User Specific Files
6+
*.user
7+
*.suo
8+
## Ignore Visual Studio temporary files, build results, and
9+
## files generated by popular Visual Studio add-ons.
10+
# User-specific files
11+
*.sln.docstates
12+
# Build results
13+
[Dd]ebug/
14+
[Rr]elease/
15+
x64/
16+
*_i.c
17+
*_p.c
18+
*.ilk
19+
*.meta
20+
*.obj
21+
*.pch
22+
*.pdb
23+
*.pgc
24+
*.pgd
25+
*.rsp
26+
*.sbr
27+
*.tlb
28+
*.tli
29+
*.tlh
30+
*.tmp
31+
*.log
32+
*.vspscc
33+
*.vssscc
34+
.builds
35+
# Visual C++ cache files
36+
ipch/
37+
*.aps
38+
*.ncb
39+
*.opensdf
40+
*.sdf
41+
# Visual Studio profiler
42+
*.psess
43+
*.vsp
44+
*.vspx
45+
# Guidance Automation Toolkit
46+
*.gpState
47+
# ReSharper is a .NET coding add-in
48+
_ReSharper*
49+
# NCrunch
50+
*.ncrunch*
51+
.*crunch*.local.xml
52+
# Installshield output folder
53+
[Ee]xpress
54+
# DocProject is a documentation generator add-in
55+
DocProject/buildhelp/
56+
DocProject/Help/*.HxT
57+
DocProject/Help/*.HxC
58+
DocProject/Help/*.hhc
59+
DocProject/Help/*.hhk
60+
DocProject/Help/*.hhp
61+
DocProject/Help/Html2
62+
DocProject/Help/html
63+
# Click-Once directory
64+
publish
65+
# Publish Web Output
66+
*.Publish.xml
67+
# Others
68+
[Bb]in
69+
[Oo]bj
70+
sql
71+
TestResults
72+
[Tt]est[Rr]esult*
73+
*.Cache
74+
ClientBin
75+
[Ss]tyle[Cc]op.*
76+
~$*
77+
*.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 ;-)
81+
_UpgradeReport_Files/
82+
Backup*/
83+
UpgradeLog.htm
84+
UpgradeLog.XML
85+
86+
# Packages
87+
nuget.exe
88+
Source/packages/*
89+
!Source/packages/repositories.config

Ether.Outcomes.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.30501.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ether.Outcomes", "Outcomes\Ether.Outcomes.csproj", "{FCC30E62-1034-43B1-85C2-AF93EC1925B7}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ether.Outcomes.Tests", "Outcomes.Tests\Ether.Outcomes.Tests.csproj", "{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{FCC30E62-1034-43B1-85C2-AF93EC1925B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{FCC30E62-1034-43B1-85C2-AF93EC1925B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{FCC30E62-1034-43B1-85C2-AF93EC1925B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{FCC30E62-1034-43B1-85C2-AF93EC1925B7}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.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>{08B07FB9-E8D7-4F4E-B5A1-9E6D98738998}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>Ether.Outcomes.Tests</RootNamespace>
10+
<AssemblyName>Ether.Outcomes.Tests</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</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="FailureTests.cs" />
54+
<Compile Include="SuccessTests.cs" />
55+
<Compile Include="Properties\AssemblyInfo.cs" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<ProjectReference Include="..\Outcomes\Ether.Outcomes.csproj">
59+
<Project>{fcc30e62-1034-43b1-85c2-af93ec1925b7}</Project>
60+
<Name>Ether.Outcomes</Name>
61+
</ProjectReference>
62+
</ItemGroup>
63+
<Choose>
64+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
65+
<ItemGroup>
66+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
67+
<Private>False</Private>
68+
</Reference>
69+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
70+
<Private>False</Private>
71+
</Reference>
72+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
73+
<Private>False</Private>
74+
</Reference>
75+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
76+
<Private>False</Private>
77+
</Reference>
78+
</ItemGroup>
79+
</When>
80+
</Choose>
81+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
82+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
83+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
84+
Other similar extension points exist, see Microsoft.Common.targets.
85+
<Target Name="BeforeBuild">
86+
</Target>
87+
<Target Name="AfterBuild">
88+
</Target>
89+
-->
90+
</Project>

Outcomes.Tests/FailureTests.cs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Security.Claims;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
5+
using Ether.Outcomes;
6+
7+
namespace Ether.Outcomes.Tests
8+
{
9+
[TestClass]
10+
public class FailureTests
11+
{
12+
[TestMethod]
13+
public void BasicFailureStateTest1()
14+
{
15+
IOutcome Outcome = Outcomes.Failure();
16+
17+
Assert.IsFalse(Outcome.Success);
18+
Assert.IsNotNull(Outcome.Messages);
19+
Assert.IsTrue(Outcome.ToString() == string.Empty);
20+
21+
//This should also work.
22+
IOutcome<object> O = (IOutcome<object>) Outcome;
23+
Assert.IsNull(O.Value);
24+
25+
}
26+
27+
[TestMethod]
28+
public void BasicFailureStateTest2()
29+
{
30+
IOutcome<int> Outcome = Outcomes.Failure<int>();
31+
32+
Assert.IsFalse(Outcome.Success);
33+
Assert.IsNotNull(Outcome.Messages);
34+
Assert.IsTrue(Outcome.Value == 0);
35+
Assert.IsTrue(Outcome.ToString() == string.Empty);
36+
}
37+
38+
[TestMethod]
39+
public void FailureChaining_MessageTest()
40+
{
41+
var Messages = new List<string> { "test2", "test3" };
42+
43+
var Outcome = Outcomes.Failure<int>().WithMessage("test1")
44+
.WithMessage(Messages);
45+
46+
Assert.IsFalse(Outcome.Success);
47+
Assert.IsTrue(Outcome.Value == 0);
48+
Assert.IsTrue(Outcome.Messages.Count == 3);
49+
Assert.IsTrue(Outcome.ToString() == "test1test2test3");
50+
Assert.IsTrue(Outcome.ToString("<br>") == "test1<br>test2<br>test3<br>");
51+
}
52+
53+
[TestMethod]
54+
public void FailureChaining_FromExceptionTest()
55+
{
56+
var Exception = new InvalidOperationException("test message");
57+
58+
var Outcome = Outcomes.Failure().FromException(Exception, "prefix message");
59+
60+
Assert.IsFalse(Outcome.Success);
61+
Assert.IsTrue(Outcome.Messages.Count == 2);
62+
Assert.IsTrue(Outcome.ToString("<br>") == "prefix message<br>Exception: test message<br>");
63+
}
64+
65+
66+
[TestMethod]
67+
public void FailureChaining_FromException_Chaining_Test()
68+
{
69+
var Exception = new InvalidOperationException("test");
70+
71+
var Outcome = Outcomes.Failure().WithMessage("prefix")
72+
.FromException(Exception)
73+
.WithMessage("suffix");
74+
Assert.IsFalse(Outcome.Success);
75+
Assert.IsTrue(Outcome.Messages.Count == 3);
76+
Assert.IsTrue(Outcome.ToString("<br>") == "prefix<br>Exception: test<br>suffix<br>");
77+
}
78+
79+
80+
[TestMethod]
81+
public void FailureChaining_FromOutcomeTest()
82+
{
83+
var PreviousOutcome = Outcomes.Failure("test");
84+
85+
var Outcome = Outcomes.Failure().FromOutcome(PreviousOutcome, "prefix");
86+
87+
Assert.IsFalse(Outcome.Success);
88+
Assert.IsTrue(Outcome.Messages.Count == 2);
89+
Assert.IsTrue(Outcome.ToString("<br>") == "prefix<br>test<br>");
90+
}
91+
92+
[TestMethod]
93+
public void FailureChaining_FromOutcome_Chaining_Test()
94+
{
95+
var PreviousOutcome = Outcomes.Failure("test");
96+
97+
var Outcome = Outcomes.Failure().WithMessage("prefix")
98+
.FromOutcome(PreviousOutcome)
99+
.WithMessage("suffix");
100+
101+
Assert.IsFalse(Outcome.Success);
102+
Assert.IsTrue(Outcome.Messages.Count == 3);
103+
Assert.IsTrue(Outcome.ToString("<br>") == "prefix<br>test<br>suffix<br>");
104+
}
105+
}
106+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Outcomes.Tests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Outcomes.Tests")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("8c17bb49-2b23-4c27-9506-f19860267760")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)