Progress Telerik JustMock

Mock Named Arguments

Nasa, Visa, Microsoft Fox, Samsung, IBM World Bank Group, Volvo
  • Mocking Methods with Named Arguments Overview

    Named arguments enable you to specify an argument for a parameter by matching the argument with its name rather than with its position in the parameter list.

    JustMock allows you to easily mock method calls with named arguments even if those methods are static.

    internal class Foo
      public static void StaticAction(int param1 = 0, int param2 = 0, int param3 = 0)
        throw new NotImplementedException();
    public void TestStaticMethodAcceptingNamedParameters()
      // Arrange
      Mock.Arrange<Foo>(() => Foo.StaticAction(param2: 2, param1: 3)).OccursOnce();
      // Act
      Foo.StaticAction(3, 2);
      // Assert

    JustMock documentation

Next Steps

See Plans & Pricing

Purchase individual products or any of the bundles

Download Free Trial

With dedicated technical support.