public static IConstructorTest Use <T>(this IConstructorTest test, T value) { if (test is Test internalTest) { var newTest = new Test(internalTest); newTest.SpecifiedValues.Add(typeof(T), value); return(newTest); } else { throw new ArgumentException("Argument not expected type", nameof(test)); } }
//NB: The necessity of this method is a code smell public static IConstructorTest AllowNull <TParameterType>(this IConstructorTest test) { if (test is Test internalTest) { var newTest = new Test(internalTest); newTest.AllowedNullParameters.Add(typeof(TParameterType)); return(newTest); } else { throw new ArgumentException("Argument not expected type", nameof(test)); } }