Example #1
0
        TestMessageVisitor <ITestAssemblyFinished> CreateVisitor(object consoleLock, string defaultDirectory, XElement assemblyElement, string visitor)
        {
            Type visitorType;

            if (visitor != null)
            {
                visitorType = _visitorService.GetVisitorType(visitor);
                if (visitorType == null)
                {
                    throw new ArgumentException("Visitor with name " + visitor + " was not found");
                }
            }
            else
            {
                visitorType = _visitorService.Recomended;
            }

            if (visitorType == null)
            {
                return(new StandardOutputVisitor(consoleLock, defaultDirectory, assemblyElement, () => cancel, completionMessages));
            }

            return((TestMessageVisitor <ITestAssemblyFinished>)Activator.CreateInstance(visitorType, assemblyElement, new Func <bool>(() => cancel)));
        }