Skip to content

Commit 0cfb3c8

Browse files
authored
Merge pull request #1 from jpopadak/ImplementingTests
Implemented tests
2 parents d299a5d + 45651c0 commit 0cfb3c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2289
-240
lines changed

CoreMatchers.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{46426862-F87D-4F76-9D85-EBE061C2E58E}"
99
ProjectSection(SolutionItems) = preProject
1010
.gitignore = .gitignore
11+
.travis.yml = .travis.yml
12+
appveyor.yml = appveyor.yml
1113
global.json = global.json
1214
LICENSE = LICENSE
1315
README.md = README.md

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Master: [![Build status](https://ci.appveyor.com/api/projects/status/arfm6jhik65jnxi6/branch/master?svg=true)](https://ci.appveyor.com/project/jpopadak/corematchers/branch/master)
1+
Master: [![Build status](https://ci.appveyor.com/api/projects/status/nk660hqrgct8mel3/branch/master?svg=true)](https://ci.appveyor.com/project/jpopadak/corematchers/branch/master)
22

33
# CoreMatchers
4-
An implementation of assertion matchers for testing. Similar to Mockito for Java
4+
An implementation of assertion matchers for testing. Similar to other test matchers for Java
55

appveyor.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
version: '1.0.{build}'
2+
configuration:
3+
- Debug
4+
- Release
5+
platform: Any CPU
6+
environment:
7+
# Don't report back to the mothership
8+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
9+
10+
# Initialize
11+
init:
12+
- ps: $Env:LABEL = "CI" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
13+
14+
before_build:
15+
- appveyor-retry dotnet restore -v Minimal
16+
17+
build_script:
18+
- dotnet build "src\CoreMatchers" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
19+
20+
after_build:
21+
- dotnet pack "src\CoreMatchers" -c %CONFIGURATION% --no-build --version-suffix %LABEL% -o artifacts
22+
23+
# Dont need this yet because we are publishing a full app, only a library
24+
#- dotnet publish "src\CoreMatchers" -c %CONFIGURATION% --no-build --version-suffix %LABEL% -o artifacts\CoreMatchers
25+
26+
test_script:
27+
- dotnet test "test\CoreMatchers.Tests" -c %CONFIGURATION%
28+
29+
artifacts:
30+
- path: artifacts\**\*.*
31+
32+
cache:
33+
- '%USERPROFILE%\.nuget\packages'
34+
35+
# Run the demo to show that it works
36+
#on_finish:
37+
#- dotnet artifacts\ConsoleApplication\ConsoleApplication.dll
38+
39+
# Slack notification
40+
notifications:
41+
- provider: Slack
42+
incoming_webhook: https://hooks.slack.com/services/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
43+
44+
# Publish the nuget package to AppVeyors account and project feeds
45+
nuget:
46+
account_feed: true
47+
project_feed: true
48+
49+
# Deploy to the NuGet site
50+
deploy:
51+
provider: NuGet
52+
api_key:
53+
secure: ioMFyLBW4dMCoxw6mxAJ30minKSdQLpVqpPzp7kzi/k0oRo+uk/mnSZkUrzY3MWZ
54+
skip_symbols: false
55+
artifact: /.*\.nupkg/

src/CoreMatchers/Assert/Asserts.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ namespace JPopadak.CoreMatchers
99
{
1010
public static class Asserts
1111
{
12-
public static void That<T>(T actual, Matcher<T> matcher)
12+
public static void That<T>(T actual, Matcher matcher)
1313
{
1414
That(string.Empty, actual, matcher);
1515
}
1616

17-
public static void That<T>(string message, T actual, Matcher<T> matcher)
17+
public static void That<T>(string message, T actual, Matcher matcher)
1818
{
1919
if (!matcher.Matches(actual))
2020
{

src/CoreMatchers/Matchers/AllOf.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
namespace JPopadak.CoreMatchers.Matchers
88
{
9-
public class AllOf<T> : DiagnosingMatcher<T>
9+
public class AllOf : DiagnosingMatcher
1010
{
11-
private readonly Matcher<T>[] _matchers;
11+
private readonly Matcher[] _matchers;
1212

13-
public AllOf(params Matcher<T>[] matchers)
13+
public AllOf(params Matcher[] matchers)
1414
{
1515
_matchers = matchers;
1616
}
1717

18-
public AllOf(IEnumerable<Matcher<T>> matchers)
18+
public AllOf(IEnumerable<Matcher> matchers)
1919
: this(matchers.ToArray())
2020
{
2121
// Do Nothing
@@ -28,7 +28,7 @@ public override void Describe(IDescription description)
2828

2929
protected override bool Matches(object actual, IDescription description)
3030
{
31-
foreach (Matcher<T> matcher in _matchers)
31+
foreach (Matcher matcher in _matchers)
3232
{
3333
if (!matcher.Matches(actual))
3434
{

src/CoreMatchers/Matchers/AnyOf.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
namespace JPopadak.CoreMatchers.Matchers
88
{
9-
public class AnyOf<T> : ShortcutCombinationMatcher<T>
9+
public class AnyOf : ShortcutCombinationMatcher
1010
{
11-
public AnyOf(params Matcher<T>[] matchers)
11+
public AnyOf(params Matcher[] matchers)
1212
: base(matchers)
1313
{
1414
// Do Nothing
1515
}
1616

17-
public AnyOf(IEnumerable<Matcher<T>> matchers)
17+
public AnyOf(IEnumerable<Matcher> matchers)
1818
: this(matchers.ToArray())
1919
{
2020
// Do Nothing

src/CoreMatchers/Matchers/BothMatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
namespace JPopadak.CoreMatchers.Matchers
77
{
8-
public sealed class BothMatcher<T>
8+
public sealed class BothMatcher
99
{
10-
private readonly Matcher<T> _firstMatcher;
10+
private readonly Matcher _firstMatcher;
1111

12-
public BothMatcher(Matcher<T> firstMatcher)
12+
public BothMatcher(Matcher firstMatcher)
1313
{
1414
_firstMatcher = firstMatcher;
1515
}
1616

17-
public CombinationMatcher<T> And(Matcher<T> secondMatcher)
17+
public CombinationMatcher<T> And<T>(Matcher secondMatcher)
1818
{
1919
return new CombinationMatcher<T>(_firstMatcher).And(secondMatcher);
2020
}

src/CoreMatchers/Matchers/CombinationBothMatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
namespace JPopadak.CoreMatchers.Matchers
77
{
8-
public sealed class CombinationBothMatcher<T>
8+
public sealed class CombinationBothMatcher
99
{
10-
private readonly Matcher<T> _firstMatcher;
10+
private readonly Matcher _firstMatcher;
1111

12-
public CombinationBothMatcher(Matcher<T> matcher)
12+
public CombinationBothMatcher(Matcher matcher)
1313
{
1414
_firstMatcher = matcher;
1515
}
1616

17-
public CombinationMatcher<T> And(Matcher<T> otherMatcher)
17+
public CombinationMatcher<T> And<T>(Matcher otherMatcher)
1818
{
1919
return new CombinationMatcher<T>(_firstMatcher).And(otherMatcher);
2020
}

src/CoreMatchers/Matchers/CombinationEitherMatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
namespace JPopadak.CoreMatchers.Matchers
77
{
8-
public sealed class CombinationEitherMatcher<T>
8+
public sealed class CombinationEitherMatcher
99
{
10-
private readonly Matcher<T> _firstMatcher;
10+
private readonly Matcher _firstMatcher;
1111

12-
public CombinationEitherMatcher(Matcher<T> firstMatcher)
12+
public CombinationEitherMatcher(Matcher firstMatcher)
1313
{
1414
_firstMatcher = firstMatcher;
1515
}
1616

17-
public CombinationMatcher<T> Or(Matcher<T> secondMatcher)
17+
public CombinationMatcher<T> Or<T>(Matcher secondMatcher)
1818
{
1919
return new CombinationMatcher<T>(_firstMatcher).Or(secondMatcher);
2020
}

src/CoreMatchers/Matchers/CombinationMatcher.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ namespace JPopadak.CoreMatchers.Matchers
88
{
99
public class CombinationMatcher<T> : TypeSafeDiagnosingMatcher<T>
1010
{
11-
private readonly Matcher<T> _matcher;
11+
private readonly Matcher _matcher;
1212

13-
public CombinationMatcher(Matcher<T> matcher)
13+
public CombinationMatcher(Matcher matcher)
1414
{
1515
_matcher = matcher;
1616
}
@@ -30,14 +30,14 @@ protected override bool MatchesSafely(T item, IDescription mismatchDescription)
3030
return true;
3131
}
3232

33-
public CombinationMatcher<T> And(Matcher<T> other)
33+
public CombinationMatcher<T> And(Matcher other)
3434
{
35-
return new CombinationMatcher<T>(new AllOf<T>(_matcher, other));
35+
return new CombinationMatcher<T>(new AllOf(_matcher, other));
3636
}
3737

38-
public CombinationMatcher<T> Or(Matcher<T> other)
38+
public CombinationMatcher<T> Or(Matcher other)
3939
{
40-
return new CombinationMatcher<T>(new AnyOf<T>(_matcher, other));
40+
return new CombinationMatcher<T>(new AnyOf(_matcher, other));
4141
}
4242
}
4343
}

0 commit comments

Comments
 (0)