Ejemplo n.º 1
0
        private void ExploreContext(IProject project, IMetadataAssembly assembly, ITypeInfo type)
        {
            var contextElement = _factory.GetOrCreateContext(
                project,
                new ClrTypeName(type.FullyQualifiedName),
                assembly.Location,
                type.GetSubject(),
                type.GetTags().ToArray(),
                type.IsIgnored());

            _observer.OnUnitTestElement(contextElement);

            var fields = type.GetFields().ToArray();

            var specifications = fields.Where(x => x.IsSpecification());
            var behaviors      = fields.Where(x => x.IsBehavior());

            foreach (var specification in specifications)
            {
                ExploreSpecification(project, contextElement, type, specification);
            }

            foreach (var behavior in behaviors)
            {
                ExploreBehavior(project, contextElement, type, behavior);
            }

            _observer.OnUnitTestElementChanged(contextElement);
        }
Ejemplo n.º 2
0
        private void ProcessContext(ITypeInfo type, IDeclaration declaration, bool isClear)
        {
            var name         = new ClrTypeName(type.FullyQualifiedName);
            var project      = declaration.GetProject();
            var assemblyPath = project?.GetOutputFilePath(_observer.TargetFrameworkId);

            var context = _factory.GetOrCreateContext(
                project,
                name,
                assemblyPath,
                type.GetSubject(),
                type.GetTags().ToArray(),
                type.IsIgnored());

            _contexts[name] = context;

            if (isClear)
            {
                OnUnitTestElement(context, declaration);
            }
        }