With Intellitest you can specify a type for Intellitest to use that fits an interface when generating unit tests, however I have a custom factory I wish to use instead.
My custom factory:
public static partial class LogicFactory
{
/// <summary>A factory for ILogic instances</summary>
[PexFactoryMethod(typeof(ILogic))]
public static ILogic Create(string defaultUICulture, bool saveSuccessful)
{
return Mock.Of<ILogic>(
x =>
x.GetUICulture(It.IsAny<string>()) == defaultUICulture &&
x.Save(It.IsAny<string>(), It.IsAny<string>()) == saveSuccessful);
}
}
I would like to use this factory for all ILogic
instances PEX tries to create.
I tried adding the following attribute to PexAssemblyInfo.cs, and I also tried adding it above my test:
[assembly: PexCreatableByClassFactory(typeof(ILogic), typeof(LogicFactory))]
but I still get this runtime warning when instrumenting code:
will use Company.Logics.SpecificLogic as ILogic
And so it seems it's ignoring my factory every time. How can I force Intellitest to use my factory instead?