Right now, if I have an interface defined like this:
public interface IHaveOptionalArguments
{
void Foo(int a, string b = "b", double c = 3.2);
}
The gen'd expectation method looks like this:
internal static global::Rocks.MethodAdornments<global::Rocks.IntegrationTests.IHaveOptionalArguments, global::System.Action<int, string, double>> Foo(
this global::Rocks.Expectations.MethodExpectations<global::Rocks.IntegrationTests.IHaveOptionalArguments> @self,
global::Rocks.Argument<int> @a,
global::Rocks.Argument<string> @b,
global::Rocks.Argument<double> @c)
I think I can do this:
internal static global::Rocks.MethodAdornments<global::Rocks.IntegrationTests.IHaveOptionalArguments, global::System.Action<int, string, double>> Foo(
this global::Rocks.Expectations.MethodExpectations<global::Rocks.IntegrationTests.IHaveOptionalArguments> @self,
global::Rocks.Argument<int> @a,
global::Rocks.Argument<string> @b = "b",
global::Rocks.Argument<double> @c = 3.2)
In other words, put the optional argument in the call site. Then, instead of having to set the expectation like this:
expectations.Methods().Foo(1, Arg.IsDefault<string>(), Arg.IsDefault<double>());
It'll be a little shorter:
expectations.Methods().Foo(1);
Developers can still choose to use Arg.IsDefault() if they want, or specify their own value.
Right now, if I have an interface defined like this:
The gen'd expectation method looks like this:
I think I can do this:
In other words, put the optional argument in the call site. Then, instead of having to set the expectation like this:
It'll be a little shorter:
Developers can still choose to use
Arg.IsDefault()if they want, or specify their own value.