public void GetImageKey_ManyImageProviders_ReturnsFirstThatReturnsKey() { ProjectImageMoniker moniker = new ProjectImageMoniker(Guid.NewGuid(), 0); var unconfiguredProject = IUnconfiguredProjectFactory.Create(capabilities: new[] { "CSharp" }); var provider1 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => null); var provider2 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => moniker); var aggregator = CreateInstance(unconfiguredProject); aggregator.ImageProviders.Add(provider1, "CSharp", 0); aggregator.ImageProviders.Add(provider2, "CSharp", 10); var result = aggregator.GetProjectImage("key"); Assert.Same(moniker, result); }
public void GetImageKey_ManyImageProviders_ReturnsFirstThatReturnsKey() { var moniker = new ProjectImageMoniker(Guid.NewGuid(), 0); var project = UnconfiguredProjectFactory.Create(); var provider1 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => null); var provider2 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => moniker); var aggregator = CreateInstance(project); aggregator.ImageProviders.Add(provider1, orderPrecedence: 0); aggregator.ImageProviders.Add(provider2, orderPrecedence: 10); var result = aggregator.GetProjectImage("key"); Assert.Same(moniker, result); }
public void GetImageKey_ManyImageProviderReturningKey_ReturnsFirstByOrder() { var moniker1 = new ProjectImageMoniker(Guid.NewGuid(), 0); var moniker2 = new ProjectImageMoniker(Guid.NewGuid(), 0); var project = UnconfiguredProjectFactory.Create(capabilities: new[] { "CSharp" }); var provider1 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => moniker1); var provider2 = IProjectImageProviderFactory.ImplementGetProjectImage((key) => moniker2); var aggregator = CreateInstance(project); aggregator.ImageProviders.Add(provider2, "CSharp", 0); // Lowest aggregator.ImageProviders.Add(provider1, "CSharp", 10); // Highest var result = aggregator.GetProjectImage("key"); Assert.Same(moniker1, result); }