static void SetFeatures(IASContext mock, IASContext context) { mock.Settings.Returns(context.Settings); mock.Features.Returns(context.Features); mock.CurrentModel.Returns(context.CurrentModel); var visibleExternalElements = context.GetVisibleExternalElements(); mock.GetVisibleExternalElements().Returns(visibleExternalElements); mock.GetCodeModel(null).ReturnsForAnyArgs(x => { var src = x[0] as string; return(string.IsNullOrEmpty(src) ? null : context.GetCodeModel(src)); }); mock.GetCodeModel(Arg.Any <string>(), Arg.Any <bool>()).ReturnsForAnyArgs(x => { var src = x[0] as string; return(string.IsNullOrEmpty(src) ? null : context.GetCodeModel(src, x.ArgAt <bool>(1))); }); mock.GetCodeModel(Arg.Any <FileModel>(), Arg.Any <string>()).ReturnsForAnyArgs(x => { var src = x[1] as string; return(string.IsNullOrEmpty(src) ? null : context.GetCodeModel(x.ArgAt <FileModel>(0), src)); }); mock.GetCodeModel(null, null, Arg.Any <bool>()).ReturnsForAnyArgs(x => { var src = x[1] as string; return(string.IsNullOrEmpty(src) ? null : context.GetCodeModel(x.ArgAt <FileModel>(0), src, x.ArgAt <bool>(2))); }); mock.GetFileModel(null).ReturnsForAnyArgs(it => { var fileName = it[0] as string; return(fileName == null ? null : context.GetFileModel(fileName)); }); mock.IsImported(null, Arg.Any <int>()).ReturnsForAnyArgs(it => { var member = it.ArgAt <MemberModel>(0) ?? ClassModel.VoidClass; return(context.IsImported(member, it.ArgAt <int>(1))); }); mock.ResolveType(null, null).ReturnsForAnyArgs(x => context.ResolveType(x.ArgAt <string>(0), x.ArgAt <FileModel>(1))); mock.ResolveToken(null, null).ReturnsForAnyArgs(x => context.ResolveToken(x.ArgAt <string>(0), x.ArgAt <FileModel>(1))); mock.ResolveDotContext(null, null, false).ReturnsForAnyArgs(it => { var expr = it.ArgAt <ASExpr>(1); return(expr == null ? null : context.ResolveDotContext(it.ArgAt <ScintillaControl>(0), expr, it.ArgAt <bool>(2))); }); mock.TypesAffinity(null, null).ReturnsForAnyArgs(it => { var inClass = it.ArgAt <ClassModel>(0); var withClass = it.ArgAt <ClassModel>(1); return(inClass == null || withClass == null ? Visibility.Default : context.TypesAffinity(inClass, withClass)); }); mock.IsFileValid.Returns(context.IsFileValid); mock.GetDefaultValue(null).ReturnsForAnyArgs(it => context.GetDefaultValue(it.ArgAt <string>(0))); mock.DecomposeTypes(null).ReturnsForAnyArgs(it => context.DecomposeTypes(it.ArgAt <IEnumerable <string> >(0) ?? new string[0])); mock.Classpath.Returns(context.Classpath); mock.CreateFileModel(null).ReturnsForAnyArgs(it => context.CreateFileModel(it.ArgAt <string>(0))); var allProjectClasses = context.GetAllProjectClasses(); mock.GetAllProjectClasses().Returns(allProjectClasses); mock.CodeGenerator.Returns(context.CodeGenerator); mock.DocumentationGenerator.Returns(context.DocumentationGenerator); }