Skip to content

Commit e7efa27

Browse files
committed
Merge branch 'release/1.0.0' into production
2 parents f6f3635 + e3ded78 commit e7efa27

36 files changed

Lines changed: 2123 additions & 0 deletions

.appveyor.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '{branch}-{build}'
2+
before_build:
3+
- cmd: nuget restore CSF.Specifications.sln
4+
build:
5+
verbosity: minimal
6+
test:
7+
assemblies:
8+
except:
9+
- '**\Ploeh.AutoFixture.NUnit3.dll'

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bin/
2+
obj/
3+
TestResult.xml
4+
TestResult.formatted.xml
5+
*.pidb
6+
*.VisualState.xml
7+
*.userprefs
8+
*.orig
9+
*.directory
10+
packages/*/*
11+
*.nupkg
12+
.vs/

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: csharp
2+
solution: CSF.Specifications.sln
3+
4+
install:
5+
- nuget restore CSF.Specifications.sln
6+
- nuget install NUnit.ConsoleRunner -Version 3.6.1 -OutputDirectory testrunner
7+
8+
script:
9+
- msbuild /p:Configuration=Debug CSF.Specifications.sln
10+
- mono "./testrunner/NUnit.ConsoleRunner.3.6.1/tools/nunit3-console.exe" Test.CSF.Specifications/bin/Debug/Test.CSF.Specifications.dll

COPYING

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Please see LICENSE for a copy of the MIT license, under which this
2+
software is released.
3+
4+
List of contributors
5+
--------------------
6+
Craig Fowler - CSF Software Limited
7+
Pete Montgomery - https://petemontgomery.wordpress.com

CSF-Software-OSS.snk

596 Bytes
Binary file not shown.

CSF.Specifications.sln

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.CSF.Specifications", "Test.CSF.Specifications\Test.CSF.Specifications.csproj", "{11DCF35A-6E2A-4C62-B536-14B83FF5AE07}"
5+
EndProject
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSF.Specifications", "CSF.Specifications\CSF.Specifications.csproj", "{27BC821D-03D4-42A0-B379-F93D021E56EC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{11DCF35A-6E2A-4C62-B536-14B83FF5AE07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{11DCF35A-6E2A-4C62-B536-14B83FF5AE07}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{11DCF35A-6E2A-4C62-B536-14B83FF5AE07}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{11DCF35A-6E2A-4C62-B536-14B83FF5AE07}.Release|Any CPU.Build.0 = Release|Any CPU
18+
{27BC821D-03D4-42A0-B379-F93D021E56EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{27BC821D-03D4-42A0-B379-F93D021E56EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{27BC821D-03D4-42A0-B379-F93D021E56EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{27BC821D-03D4-42A0-B379-F93D021E56EC}.Release|Any CPU.Build.0 = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(MonoDevelopProperties) = preSolution
24+
Policies = $0
25+
$0.TextStylePolicy = $1
26+
$1.TabWidth = 2
27+
$1.IndentWidth = 2
28+
$1.NoTabsAfterNonTabs = True
29+
$1.scope = text/plain
30+
$1.TabsToSpaces = True
31+
$0.StandardHeader = $2
32+
$2.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) ${Year} ${CopyrightHolder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
33+
$0.DotNetNamingPolicy = $3
34+
$3.DirectoryNamespaceAssociation = PrefixedHierarchical
35+
$3.ResourceNamePolicy = FileName
36+
$0.NameConventionPolicy = $4
37+
$4.Rules = $5
38+
$5.NamingRule = $6
39+
$6.Name = Namespaces
40+
$6.AffectedEntity = Namespace
41+
$6.VisibilityMask = VisibilityMask
42+
$6.NamingStyle = PascalCase
43+
$6.IncludeInstanceMembers = True
44+
$6.IncludeStaticEntities = True
45+
$5.NamingRule = $7
46+
$7.Name = Types
47+
$7.AffectedEntity = Class, Struct, Enum, Delegate
48+
$7.VisibilityMask = Public
49+
$7.NamingStyle = PascalCase
50+
$7.IncludeInstanceMembers = True
51+
$7.IncludeStaticEntities = True
52+
$5.NamingRule = $8
53+
$8.Name = Interfaces
54+
$8.RequiredPrefixes = $9
55+
$9.String = I
56+
$8.AffectedEntity = Interface
57+
$8.VisibilityMask = Public
58+
$8.NamingStyle = PascalCase
59+
$8.IncludeInstanceMembers = True
60+
$8.IncludeStaticEntities = True
61+
$5.NamingRule = $10
62+
$10.Name = Attributes
63+
$10.RequiredSuffixes = $11
64+
$11.String = Attribute
65+
$10.AffectedEntity = CustomAttributes
66+
$10.VisibilityMask = Public
67+
$10.NamingStyle = PascalCase
68+
$10.IncludeInstanceMembers = True
69+
$10.IncludeStaticEntities = True
70+
$5.NamingRule = $12
71+
$12.Name = Event Arguments
72+
$12.RequiredSuffixes = $13
73+
$13.String = EventArgs
74+
$12.AffectedEntity = CustomEventArgs
75+
$12.VisibilityMask = Public
76+
$12.NamingStyle = PascalCase
77+
$12.IncludeInstanceMembers = True
78+
$12.IncludeStaticEntities = True
79+
$5.NamingRule = $14
80+
$14.Name = Exceptions
81+
$14.RequiredSuffixes = $15
82+
$15.String = Exception
83+
$14.AffectedEntity = CustomExceptions
84+
$14.VisibilityMask = VisibilityMask
85+
$14.NamingStyle = PascalCase
86+
$14.IncludeInstanceMembers = True
87+
$14.IncludeStaticEntities = True
88+
$5.NamingRule = $16
89+
$16.Name = Methods
90+
$16.AffectedEntity = Methods
91+
$16.VisibilityMask = Protected, Public
92+
$16.NamingStyle = PascalCase
93+
$16.IncludeInstanceMembers = True
94+
$16.IncludeStaticEntities = True
95+
$5.NamingRule = $17
96+
$17.Name = Static Readonly Fields
97+
$17.AffectedEntity = ReadonlyField
98+
$17.VisibilityMask = Protected, Public
99+
$17.NamingStyle = PascalCase
100+
$17.IncludeInstanceMembers = False
101+
$17.IncludeStaticEntities = True
102+
$5.NamingRule = $18
103+
$18.Name = Fields
104+
$18.AffectedEntity = Field
105+
$18.VisibilityMask = Protected, Public
106+
$18.NamingStyle = PascalCase
107+
$18.IncludeInstanceMembers = True
108+
$18.IncludeStaticEntities = True
109+
$5.NamingRule = $19
110+
$19.Name = ReadOnly Fields
111+
$19.AffectedEntity = ReadonlyField
112+
$19.VisibilityMask = Protected, Public
113+
$19.NamingStyle = PascalCase
114+
$19.IncludeInstanceMembers = True
115+
$19.IncludeStaticEntities = False
116+
$5.NamingRule = $20
117+
$20.Name = Constant Fields
118+
$20.AffectedEntity = ConstantField
119+
$20.VisibilityMask = Protected, Public
120+
$20.NamingStyle = PascalCase
121+
$20.IncludeInstanceMembers = True
122+
$20.IncludeStaticEntities = True
123+
$5.NamingRule = $21
124+
$21.Name = Properties
125+
$21.AffectedEntity = Property
126+
$21.VisibilityMask = Protected, Public
127+
$21.NamingStyle = PascalCase
128+
$21.IncludeInstanceMembers = True
129+
$21.IncludeStaticEntities = True
130+
$5.NamingRule = $22
131+
$22.Name = Events
132+
$22.AffectedEntity = Event
133+
$22.VisibilityMask = Protected, Public
134+
$22.NamingStyle = PascalCase
135+
$22.IncludeInstanceMembers = True
136+
$22.IncludeStaticEntities = True
137+
$5.NamingRule = $23
138+
$23.Name = Enum Members
139+
$23.AffectedEntity = EnumMember
140+
$23.VisibilityMask = VisibilityMask
141+
$23.NamingStyle = PascalCase
142+
$23.IncludeInstanceMembers = True
143+
$23.IncludeStaticEntities = True
144+
$5.NamingRule = $24
145+
$24.Name = Parameters
146+
$24.AffectedEntity = Parameter
147+
$24.VisibilityMask = VisibilityMask
148+
$24.NamingStyle = CamelCase
149+
$24.IncludeInstanceMembers = True
150+
$24.IncludeStaticEntities = True
151+
$5.NamingRule = $25
152+
$25.Name = Type Parameters
153+
$25.RequiredPrefixes = $26
154+
$26.String = T
155+
$25.AffectedEntity = TypeParameter
156+
$25.VisibilityMask = VisibilityMask
157+
$25.NamingStyle = PascalCase
158+
$25.IncludeInstanceMembers = True
159+
$25.IncludeStaticEntities = True
160+
version = 1.0.0
161+
EndGlobalSection
162+
EndGlobal
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{27BC821D-03D4-42A0-B379-F93D021E56EC}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>CSF</RootNamespace>
11+
<AssemblyName>CSF.Specifications</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<ReleaseVersion>1.0.0</ReleaseVersion>
14+
<SignAssembly>true</SignAssembly>
15+
<AssemblyOriginatorKeyFile>..\CSF-Software-OSS.snk</AssemblyOriginatorKeyFile>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
<ConsolePause>false</ConsolePause>
26+
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
27+
<DocumentationFile>bin\Debug\CSF.Specifications.xml</DocumentationFile>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release</OutputPath>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<ConsolePause>false</ConsolePause>
35+
<DefineConstants>TRACE</DefineConstants>
36+
<DocumentationFile>bin\Release\CSF.Specifications.xml</DocumentationFile>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="System" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Compile Include="Properties\AssemblyInfo.cs" />
43+
<Compile Include="ParameterRebinder.cs" />
44+
<Compile Include="Predicate.cs" />
45+
<Compile Include="Specifications\ISpecification.cs" />
46+
<Compile Include="Specifications\ISpecification`1.cs" />
47+
<Compile Include="Specifications\ISpecificationExpression.cs" />
48+
<Compile Include="Specifications\Specification`1.cs" />
49+
<Compile Include="Specifications\SpecificationExpression.cs" />
50+
<Compile Include="Specifications\DynamicSpecificationExpression.cs" />
51+
<Compile Include="Specifications\SpecificationExtensions.cs" />
52+
<Compile Include="Specifications\Specification.cs" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<Folder Include="Specifications\" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<None Include="CSF.Specifications.nuspec" />
59+
</ItemGroup>
60+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
61+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package>
3+
<metadata>
4+
<id>CSF.Specifications</id>
5+
<version>1.0.0</version>
6+
<title>CSF.Specifications</title>
7+
<authors>CSF Software Ltd</authors>
8+
<licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
9+
<projectUrl>https://github.com/csf-dev/CSF.Specifications</projectUrl>
10+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
11+
<description>Types for working with predicate expressions, including the specification pattern.</description>
12+
<copyright>Copyright 2019</copyright>
13+
</metadata>
14+
<files>
15+
<file src="bin/Release/CSF.Specifications.dll" target="lib/net45" />
16+
<file src="bin/Release/CSF.Specifications.xml" target="lib/net45" />
17+
</files>
18+
</package>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// PredicateBuilder.cs
3+
//
4+
// Authors:
5+
// Pete Montgomery https://petemontgomery.wordpress.com
6+
// Craig Fowler <craig@csf-dev.com>
7+
//
8+
// Copyright (c) 2011 Pete Montgomery, further work 2018 Craig Fowler
9+
//
10+
// Permission is hereby granted, free of charge, to any person obtaining a copy
11+
// of this software and associated documentation files (the "Software"), to deal
12+
// in the Software without restriction, including without limitation the rights
13+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
// copies of the Software, and to permit persons to whom the Software is
15+
// furnished to do so, subject to the following conditions:
16+
//
17+
// The above copyright notice and this permission notice shall be included in
18+
// all copies or substantial portions of the Software.
19+
//
20+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26+
// THE SOFTWARE.
27+
using System.Collections.Generic;
28+
using System.Linq.Expressions;
29+
30+
namespace CSF
31+
{
32+
/// <summary>
33+
/// Implementation of <c>ExpressionVisitor</c> which alters the parameters of an expression and re-binds them using a
34+
/// set of replacement parameters.
35+
/// </summary>
36+
class ParameterRebinder : ExpressionVisitor
37+
{
38+
readonly Dictionary<ParameterExpression, ParameterExpression> parametersAndReplacements;
39+
40+
/// <summary>
41+
/// Visits a parameter of the visited expression and replaces it with a corresponding parameter from the
42+
/// replacement list (if the parameter is indicated for replacement).
43+
/// </summary>
44+
/// <returns>The parameter, or its replacement.</returns>
45+
/// <param name="parameter">The visited parameter.</param>
46+
protected override Expression VisitParameter(ParameterExpression parameter)
47+
{
48+
ParameterExpression replacement;
49+
50+
if(parametersAndReplacements.TryGetValue(parameter, out replacement))
51+
{
52+
parameter = replacement;
53+
}
54+
55+
return base.VisitParameter(parameter);
56+
}
57+
58+
/// <summary>
59+
/// Initializes a new instance of the <see cref="T:CSF.ParameterRebinder"/> class.
60+
/// </summary>
61+
/// <param name="parametersAndReplacements">A map of the expected parameters and their replacements.</param>
62+
internal ParameterRebinder(Dictionary<ParameterExpression, ParameterExpression> parametersAndReplacements)
63+
{
64+
this.parametersAndReplacements = parametersAndReplacements ?? new Dictionary<ParameterExpression, ParameterExpression>();
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)