Пример #1
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementConsumer consumer)
                {
                    this.provider = provider;
                    this.consumer = consumer;

                    messageConsumer = new MessageConsumer()
                                      .Handle <TestDiscoveredMessage>(HandleTestDiscoveredMessage)
                                      .Handle <AnnotationDiscoveredMessage>(HandleAnnotationDiscoveredMessage);
                }
Пример #2
0
            /// <summary>
            /// Initializes the provider.
            /// </summary>
            public Shim(GallioTestProvider provider)
            {
                this.provider = provider;

                testFrameworkManager = RuntimeAccessor.ServiceLocator.Resolve <ITestFrameworkManager>();
                logger = new FacadeLoggerWrapper(new AdapterFacadeLogger());

                RuntimeAccessor.Instance.AddLogListener(logger);
            }
		public void Test_name()
		{
			var provider = new GallioTestProvider();
			const string assemblyPath = "assemblyPath";
			var element = new TestUnitTestElement(null, null, "", "", "", false, null, null, assemblyPath, "", "");
			var explicitElements = new List<UnitTestElement>();

			var taskSequence = provider.GetTaskSequence(element, explicitElements);

			var unitTestTask = taskSequence[0];
			Assert.IsInstanceOfType(typeof(AssemblyLoadTask), unitTestTask.RemoteTask);
			Assert.AreEqual(assemblyPath, ((AssemblyLoadTask) unitTestTask.RemoteTask).AssemblyCodeBase);
		}
Пример #4
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementLocationConsumer consumer, ITreeNode psiFile)
                    : this(provider, delegate(IUnitTestElement element)
                {
                    var projectFile = psiFile.GetSourceFile().ToProjectFile();

                    if (projectFile == null || !projectFile.IsValid())
                    {
                        return;
                    }

                    consumer(element.GetDisposition());
                })
                {
                }
Пример #5
0
 private GallioTestElement(GallioTestProvider provider, GallioTestElement parent, string testId, string testName, string kind, bool isTestCase,
                           IProject project, IDeclaredElementResolver declaredElementResolver, string assemblyPath, string typeName, string namespaceName)
 {
     this.provider   = provider;
     Id              = testId;
     TestId          = testId;
     this.testName   = testName;
     Children        = new List <IUnitTestElement>();
     Parent          = parent;
     Kind            = kind;
     this.isTestCase = isTestCase;
     this.project    = project;
     this.declaredElementResolver = declaredElementResolver;
     this.assemblyPath            = assemblyPath;
     this.typeName      = typeName;
     this.namespaceName = namespaceName;
 }
Пример #6
0
        public static GallioTestElement CreateFromTest(TestData test, ICodeElementInfo codeElement, GallioTestProvider provider, GallioTestElement parent)
        {
            if (test == null)
            {
                throw new ArgumentNullException("test");
            }

            // The idea here is to generate a test element object that does not retain any direct
            // references to the code element info and other heavyweight objects.  A test element may
            // survive in memory for quite a long time so we don't want it holding on to all sorts of
            // irrelevant stuff.  Basically we flatten out the test to just those properties that we
            // need to keep.
            var project = ReSharperReflectionPolicy.GetProject(codeElement);
            var element = GetElementById(project, test.Id);

            if (element == null)
            {
                element = new GallioTestElement(provider, parent,
                                                test.Id,
                                                test.Name,
                                                test.Metadata.GetValue(MetadataKeys.TestKind) ?? "Unknown",
                                                test.IsTestCase,
                                                project,
                                                ReSharperReflectionPolicy.GetDeclaredElementResolver(codeElement),
                                                GetAssemblyPath(codeElement),
                                                GetTypeName(codeElement),
                                                GetNamespaceName(codeElement));
            }
            element.State = UnitTestElementState.Valid;

            var categories = test.Metadata[MetadataKeys.Category];

            element.Categories = UnitTestElementCategory.Create(categories);

            var reason = test.Metadata.GetValue(MetadataKeys.IgnoreReason);

            if (reason != null)
            {
                element.Explicit       = true;
                element.ExplicitReason = reason;
            }

            return(element);
        }
Пример #7
0
        public static IUnitTestElement Deserialize(XmlElement parent, IUnitTestElement parentElement, GallioTestProvider provider)
        {
            //var projectId = parent.GetAttribute("projectId");
            //var project = ProjectUtil.FindProjectElementByPersistentID(provider.Solution, projectId) as IProject;
            //if (project == null)
            //{
            //    return null;
            //}

            //var testId = parent.GetAttribute("testId");
            //var element = provider.UnitTestManager.GetElementById(project, testId) as GallioTestElement;
            //if (element != null)
            //{
            //    element.Parent = parentElement;
            //    element.State = UnitTestElementState.Valid;
            //    return element;
            //}

            return(null);
        }
Пример #8
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementLocationConsumer consumer, ITreeNode psiFile)
                    : this(provider, delegate(IUnitTestElement element)
                    {
                        var projectFile = psiFile.GetSourceFile().ToProjectFile();

                    	if (projectFile == null || !projectFile.IsValid()) 
							return;

                        consumer(element.GetDisposition());
                    })
                {
                }
Пример #9
0
                public ConsumerAdapter(GallioTestProvider provider, UnitTestElementConsumer consumer)
                {
                    this.provider = provider;
                    this.consumer = consumer;

                    messageConsumer = new MessageConsumer()
                        .Handle<TestDiscoveredMessage>(HandleTestDiscoveredMessage)
                        .Handle<AnnotationDiscoveredMessage>(HandleAnnotationDiscoveredMessage);
                }
Пример #10
0
        	/// <summary>
            /// Initializes the provider.
            /// </summary>
            public Shim(GallioTestProvider provider)
            {
                this.provider = provider;

                testFrameworkManager = RuntimeAccessor.ServiceLocator.Resolve<ITestFrameworkManager>();
                logger = new FacadeLoggerWrapper(new AdapterFacadeLogger());

                RuntimeAccessor.Instance.AddLogListener(logger);
            }