Here's the example:
using Rocks;
using System;
using System.Threading.Tasks;
namespace MockTests
{
public struct SomeStruct { }
public interface IRequest<T>
where T : class
{
Task<T> Send(object values, SomeStruct someStruct = default);
Task Send(T message, SomeStruct someStruct = default);
}
public static class Test
{
public static void Generate()
{
var rock = Rock.Create<IRequest<object>>();
}
}
}
This will compile in a test, but there will be warnings for CS1066. Basically, the resulting mock is putting the default values in (note that it doesn't matter that it's default, just whatever the default value is) in for the method that is explicitly implemented. If warnings are errors, this will fail. (For more information, look here).
The fix looks like we just don't emit any default values for parameters on explicitly implemented methods (I'm guessing this is true for indexers as well).
This was found with MassTransist.IRequestClient<>
Here's the example:
This will compile in a test, but there will be warnings for
CS1066. Basically, the resulting mock is putting the default values in (note that it doesn't matter that it'sdefault, just whatever the default value is) in for the method that is explicitly implemented. If warnings are errors, this will fail. (For more information, look here).The fix looks like we just don't emit any default values for parameters on explicitly implemented methods (I'm guessing this is true for indexers as well).
This was found with
MassTransist.IRequestClient<>