Skip to content

Methods With Over 16 Parameters Cause Expectation Extension Method Issues #234

@JasonBock

Description

@JasonBock

To reproduce:

using Rocks;
			
namespace MockTests
{
	public interface IHaveTooMuch
	{
		int AddProperty(
			int i0, int i1, int i2, int i3, int i4,
			int i5, int i6, int i7, int i8, int i9,
			int i10, int i11, int i12, int i13, int i14,
			int i15, int i16, int i17, int i18, int i19);
	}

	public static class Test
	{
		public static void Generate()
		{
			var rock = Rock.Create<IHaveTooMuch>();
		}
	}
}

This leads to the following error:

error CS0305: Using the generic type 'Func<TResult>' requires 1 type arguments

Basically, Rocks tries to use Func and Action for the extension methods, and if a method goes over 16 parameters, it won't work. Rocks will need to generate a custom delegate for that case.

This was found in Microsoft.EntityFrameworkCore.Metadata.RuntimeEntityType.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions