Skip to content

Instantly share code, notes, and snippets.

View jbogard's full-sized avatar

Jimmy Bogard jbogard

View GitHub Profile
private static void FixEntryAssembly()
{
// http://dejanstojanovic.net/aspnet/2015/january/set-entry-assembly-in-unit-testing-methods/
AppDomainManager manager = new AppDomainManager();
FieldInfo entryAssemblyfield = manager.GetType()
.GetField("m_entryAssembly", BindingFlags.Instance | BindingFlags.NonPublic);
entryAssemblyfield?.SetValue(manager, typeof(Startup).Assembly);
AppDomain domain = AppDomain.CurrentDomain;
FieldInfo domainManagerField = domain.GetType()
Test Name: ContosoUniversityCore.IntegrationTests.Features.Instructor.DeleteTests.Should_delete_instructor
Test FullName: ContosoUniversityCore.IntegrationTests.Features.Instructor.DeleteTests.Should_delete_instructor
Test Source: : line -1
Test Outcome: Failed
Test Duration: 0:00:00
Result StackTrace:
System.TypeInitializationException
at ContosoUniversityCore.IntegrationTests.SliceFixture..ctor()
at ContosoUniversityCore.IntegrationTests.FixturePerMethodConvention.<>c.<.ctor>b__0_0(MethodInfo mi)
services.AddAutoMapper();
Mapper.AssertConfigurationIsValid();
services.AddMediatR();
services.AddScoped(_ => new SchoolContext(Configuration["Data:DefaultConnection:ConnectionString"]));
services.AddHtmlTags(new TagConventions());
public interface IRequestHandler<in TRequest, out TResponse>
where TRequest : IRequest<TResponse>
{
TResponse Handle(TRequest message);
}
public interface IRequestHandler<in TRequest>
where TRequest : IRequest
{
void Handle(TRequest message);
public interface IMediator
{
Task<TResponse> SendAsync<TResponse>(IRequest<TResponse> request, CancellationToken cancellationToken = default(CancellationToken));
Task SendAsync(IRequest request, CancellationToken cancellationToken = default(CancellationToken));
Task PublishAsync(INotification notification, CancellationToken cancellationToken = default(CancellationToken));
}
public delegate Task<TResponse> RequestHandlerDelegate<TResponse>();

Subject: Funding for MediatR?

I’m working on solving the problem of sustainability in FOSS and I need your help. It looks like MediatR is struggling to keep its head above water: the average age of open issues is 5 months; there’s an issue from 2016-03-16 with no activity; and an issue from 2015-10-21 still pending.

Two quick questions for you:

  1. If MediatR was funded, with a livable income (like a few tens of thousands of dollars per year) would you be interested in bringing everything current and then maintaining it at a professional level?
  2. If you’re the license holder, are you open to changing your license? Eg. if I could show you a new license which retains all the community/free/open benefits of the FOSS license you’re currently using but also obligates companies who make money using your software to pay a fee to you?

Thanks, that’s it. Just reply to this email. Huge thanks for even reading this far.

await _fixture.ExecuteDbContextAsync(async dbContext =>
{
var found = await dbContext.Employees.FindAsync(employee.Id);
found.Email.ShouldBe(command.Email);
found.FirstName.ShouldBe(command.FirstName);
found.LastName.ShouldBe(command.LastName);
found.Office.ShouldBe(command.Office);
found.Title.ShouldBe(command.Title);
found.PhoneNumber.ShouldBe(command.PhoneNumber);
var command = new Edit.Command
{
Id = employee.Id,
Email = "jane@jane2.com",
FirstName = "Jane2",
LastName = "Smith2",
Office = Office.Dallas,
Title = "CEO",
PhoneNumber = "512-555-9999"
};
public async Task<TResponse> SendAsync<TResponse>(IAsyncRequest<TResponse> request)
{
var response = default(TResponse);
await ExecuteScopeAsync(async sp =>
{
var mediator = sp.GetService<IMediator>();
response = await mediator.SendAsync(request);
});
return response;
[Fact]
[ResetDatabase]
public async Task ShouldEditEmployee()
{
var employee = new Employee
{
Email = "jane@jane.com",
FirstName = "Jane",
LastName = "Smith",
Title = "Director",