コード例 #1
0
 public ImplicitProjectPropertiesProvider(
     [Import(ContractNames.ProjectPropertyProviders.ProjectFile)] IProjectPropertiesProvider provider,
     [Import(ContractNames.ProjectPropertyProviders.ProjectFile)] IProjectInstancePropertiesProvider instanceProvider,
     ImplicitProjectPropertiesStore <string, string> propertyStore,
     UnconfiguredProject unconfiguredProject)
     : base(provider, instanceProvider, unconfiguredProject)
 {
     _propertyStore = propertyStore;
 }
コード例 #2
0
        public void Provider_ReturnsImplicitPropertyProvider()
        {
            var unconfiguredProject = IUnconfiguredProjectFactory.Create();
            var instanceProvider    = IProjectInstancePropertiesProviderFactory.ImplementsGetItemTypeProperties();

            var delegatePropertiesMock = IProjectPropertiesFactory
                                         .MockWithPropertyAndValue("Something", "NotImportant");

            var delegateProperties = delegatePropertiesMock.Object;
            var delegateProvider   = IProjectPropertiesProviderFactory.Create(delegateProperties);
            var propertyStore      = new ImplicitProjectPropertiesStore <string, string>(unconfiguredProject);

            var provider   = new ImplicitProjectPropertiesProvider(delegateProvider, instanceProvider, propertyStore, unconfiguredProject);
            var properties = provider.GetItemTypeProperties(null, "");

            properties.SetPropertyValueAsync("ProjectGuid", "7259e9ef-87d1-45a5-95c6-3a8432d23776");

            Assert.Equal("7259e9ef-87d1-45a5-95c6-3a8432d23776", properties.GetEvaluatedPropertyValueAsync("ProjectGuid").Result);
        }
コード例 #3
0
        public void Provider_IgnoresPropertyIfAbsent()
        {
            var unconfiguredProject = IUnconfiguredProjectFactory.Create();
            var instanceProvider    = IProjectInstancePropertiesProviderFactory.Create();

            var delegatePropertiesMock = IProjectPropertiesFactory
                                         .MockWithProperty("SomeOtherProperty");

            var delegateProperties = delegatePropertiesMock.Object;
            var delegateProvider   = IProjectPropertiesProviderFactory.Create(delegateProperties);
            var propertyStore      = new ImplicitProjectPropertiesStore <string, string>(unconfiguredProject);

            var provider   = new ImplicitProjectPropertiesProvider(delegateProvider, instanceProvider, propertyStore, unconfiguredProject);
            var properties = provider.GetProperties("path/to/project.testproj", null, null);

            // does not call the set property on the delegated property above
            properties.SetPropertyValueAsync("ProjectGuid", "7259e9ef-87d1-45a5-95c6-3a8432d23776");

            // verify all the setups
            delegatePropertiesMock.VerifyAll();
        }
コード例 #4
0
        public void Provider_SetsPropertyIfPresent()
        {
            var unconfiguredProject = IUnconfiguredProjectFactory.Create();
            var instanceProvider    = IProjectInstancePropertiesProviderFactory.Create();

            var delegatePropertiesMock = IProjectPropertiesFactory
                                         .MockWithPropertyAndValue("ProjectGuid", "7259e9ef-87d1-45a5-95c6-3a8432d23776");

            var delegateProperties = delegatePropertiesMock.Object;
            var delegateProvider   = IProjectPropertiesProviderFactory.Create(delegateProperties);
            var propertyStore      = new ImplicitProjectPropertiesStore <string, string>(unconfiguredProject);

            var provider   = new ImplicitProjectPropertiesProvider(delegateProvider, instanceProvider, propertyStore, unconfiguredProject);
            var properties = provider.GetProperties("path/to/project.testproj", null, null);

            // calls delegate above with matching values
            properties.SetPropertyValueAsync("ProjectGuid", "7259e9ef-87d1-45a5-95c6-3a8432d23776");

            // verify all the setups
            delegatePropertiesMock.Verify(p => p.SetPropertyValueAsync("ProjectGuid", "7259e9ef-87d1-45a5-95c6-3a8432d23776", null));
        }