public async Task when_action_then_assert() { var workspace = MSBuildWorkspace.Create(); var projectPath = new FileInfo(@"..\..\..\Clide\Clide.csproj").FullName; await workspace.OpenSolutionAsync(@"..\..\..\Clide.sln"); var project = workspace.CurrentSolution.Projects.Where(x => string.Equals(x.FilePath, projectPath, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); var compilation = await project.GetCompilationAsync(); Assert.NotNull(project); var observableAttribute = compilation .GetSymbolsWithName(name => name == ComponentAttribute, SymbolFilter.Type) .FirstOrDefault(a => a.ContainingNamespace.Name == "Clide"); var observables = new List <INamedTypeSymbol>(); foreach (var document in project.Documents) { var syntax = await document.GetSyntaxTreeAsync(); var semanticModel = compilation.GetSemanticModel(syntax); var visitor = new ComponentVisitor(semanticModel, observableAttribute); visitor.Visit(syntax.GetRoot()); observables.AddRange(visitor.observables); } foreach (var observable in observables) { var observableInterfaces = observable.AllInterfaces.Where(i => i.IsGenericType && i.ConstructedFrom.ToString() == "System.IObservable<T>").ToList(); Console.WriteLine(observableInterfaces.Count); } //var task = Mock.Of<Task> //var project = }
public BuildComponentInspectorData(BuildConfigurationInspectorData config, IBuildComponent value) { m_Config = config; ComponentType = value.GetType(); ComponentSource = config.GetComponentSource(ComponentType); IsComponentPresent = config.HasComponent(ComponentType); IsComponentInherited = config.IsComponentInherited(ComponentType); IsComponentOverriding = config.IsComponentOverriding(ComponentType); IsComponentUsed = config.IsComponentUsed(ComponentType); ConfigHasPipeline = config.HasPipeline; ComponentName = ObjectNames.NicifyVariableName(ComponentType.Name); var visitor = new ComponentVisitor(); PropertyContainer.Visit(ref value, visitor); FieldNames = visitor.FieldNames; IsPipelineComponent = typeof(IBuildPipelineComponent).IsAssignableFrom(ComponentType); IsTagComponent = FieldNames.Length == 0; Icon = Resources.BuildComponentIcon; Value = value; }
public async Task when_action_then_assert() { var workspace = MSBuildWorkspace.Create(); var projectPath = new FileInfo(@"..\..\..\Clide\Clide.csproj").FullName; await workspace.OpenSolutionAsync(@"..\..\..\Clide.sln"); var project = workspace.CurrentSolution.Projects.Where(x => string.Equals(x.FilePath, projectPath, StringComparison.InvariantCultureIgnoreCase)) .FirstOrDefault(); var compilation = await project.GetCompilationAsync(); Assert.NotNull(project); var observableAttribute = compilation .GetSymbolsWithName(name => name == ComponentAttribute, SymbolFilter.Type) .FirstOrDefault(a => a.ContainingNamespace.Name == "Clide"); var observables = new List<INamedTypeSymbol>(); foreach (var document in project.Documents) { var syntax = await document.GetSyntaxTreeAsync(); var semanticModel = compilation.GetSemanticModel(syntax); var visitor = new ComponentVisitor(semanticModel, observableAttribute); visitor.Visit(syntax.GetRoot()); observables.AddRange(visitor.observables); } foreach (var observable in observables) { var observableInterfaces = observable.AllInterfaces.Where(i => i.IsGenericType && i.ConstructedFrom.ToString() == "System.IObservable<T>").ToList(); Console.WriteLine(observableInterfaces.Count); } //var task = Mock.Of<Task> //var project = }