Created
December 8, 2017 01:43
-
-
Save dcomartin/53189bbd85176cff10180e29630b09fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Shouldly; | |
using Xunit; | |
namespace MediatR.Pair | |
{ | |
public class Test | |
{ | |
[Fact] | |
public void Should_return_requests_with_no_handlers() | |
{ | |
var noMatch = MediatorPair.FindUnmatchedRequests(Assembly.GetExecutingAssembly()); | |
noMatch.Count().ShouldBe(2); | |
noMatch.SingleOrDefault(x => x == typeof(MyRequestWithoutHandler)).ShouldNotBeNull(); | |
noMatch.SingleOrDefault(x => x == typeof(MyRequestWithResultWithoutHandler)).ShouldNotBeNull(); | |
} | |
} | |
public class MyRequest : IRequest { } | |
public class MyRequestHandler : IRequestHandler<MyRequest> | |
{ | |
public Task Handle(MyRequest message, CancellationToken cancellationToken) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class MyRequestWithoutHandler : IRequest { } | |
public class MyRequestWithResult : IRequest<bool> { } | |
public class MyRequestWithResultHandler : IRequestHandler<MyRequestWithResult, bool> | |
{ | |
public Task<bool> Handle(MyRequestWithResult request, CancellationToken cancellationToken) | |
{ | |
throw new NotImplementedException(); | |
} | |
} | |
public class MyRequestWithResultWithoutHandler : IRequest<bool> { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment