示例#1
0
        private static InterceptedProjectPropertiesProviderBase CreateInstance(FrameworkName configuredTargetFramework)
        {
            var data = new PropertyPageData(ConfigurationGeneral.SchemaName, ConfigurationGeneral.TargetFrameworkMonikerProperty, configuredTargetFramework.FullName);

            var project          = UnconfiguredProjectFactory.Create();
            var properties       = ProjectPropertiesFactory.Create(project, data);
            var delegateProvider = IProjectPropertiesProviderFactory.Create();

            var instancePropertiesMock = IProjectPropertiesFactory
                                         .MockWithProperty(TargetFrameworkPropertyName);

            var instanceProperties = instancePropertiesMock.Object;
            var instanceProvider   = IProjectInstancePropertiesProviderFactory.ImplementsGetCommonProperties(instanceProperties);

            var targetFrameworkProvider = new TargetFrameworkValueProvider(properties);
            var providerMetadata        = IInterceptingPropertyValueProviderMetadataFactory.Create(TargetFrameworkPropertyName);
            var lazyArray = new[] { new Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata>(
                                        () => targetFrameworkProvider, providerMetadata) };

            return(new ProjectFileInterceptedViaSnapshotProjectPropertiesProvider(delegateProvider, instanceProvider, project, lazyArray));
        }
示例#2
0
 public TestProjectFileOrAssemblyInfoPropertiesProvider(
     Workspace workspace,
     UnconfiguredProject unconfiguredProject,
     Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata> interceptingProvider = null,
     IProjectThreadingService threadingService           = null,
     IProjectProperties defaultProperties                = null,
     IProjectInstancePropertiesProvider instanceProvider = null,
     Func <ProjectId> getActiveProjectId = null)
     : base(delegatedProvider : IProjectPropertiesProviderFactory.Create(defaultProperties ?? IProjectPropertiesFactory.MockWithProperty("").Object),
            instanceProvider : instanceProvider ?? IProjectInstancePropertiesProviderFactory.Create(),
            interceptingValueProviders : interceptingProvider == null ?
            new[] { new Lazy <IInterceptingPropertyValueProvider, IInterceptingPropertyValueProviderMetadata>(
                        () => IInterceptingPropertyValueProviderFactory.Create(),
                        IInterceptingPropertyValueProviderMetadataFactory.Create("")) } :
            new[] { interceptingProvider },
            unconfiguredProject : unconfiguredProject,
            getActiveProjectId : getActiveProjectId ?? (() => workspace.CurrentSolution.ProjectIds.SingleOrDefault()),
            workspace : workspace,
            threadingService : threadingService ?? IProjectThreadingServiceFactory.Create())
 {
     Requires.NotNull(workspace, nameof(workspace));
     Requires.NotNull(unconfiguredProject, nameof(unconfiguredProject));
 }