public void GetResolver_DoesNotDuplicateFeeds() { // Arrange var mod = _testEnvironmoent.TestModConfigATuple; // Act var resolverFactory = new NuGetUpdateResolverFactory(); resolverFactory.SetConfiguration(mod, new NuGetUpdateResolverFactory.NuGetConfig() { DefaultRepositoryUrls = new ObservableCollection <StringWrapper>() { "Sample Repository" } }); using var disposalHelper = new RemoveConfiguration <NuGetUpdateResolverFactory.NuGetConfig>(mod, resolverFactory); var resolver = (AggregatePackageResolver)resolverFactory.GetResolver(mod, null, new UpdaterData(new List <string>() { "Sample Repository" }, new CommonPackageResolverSettings())); // Assert Assert.Equal(1, resolver.Count); }
public void GetResolver_ReturnsNullOnNoConfig() { // Arrange var mod = _testEnvironmoent.TestModConfigATuple; // Act var resolverFactory = new NuGetUpdateResolverFactory(); var resolver = resolverFactory.GetResolver(mod, null, new UpdaterData(new List <string>(), new CommonPackageResolverSettings())); // Assert Assert.Null(resolver); }
public void GetResolver_UsesMainConfigUrls_BeforeSecurityPolicyMigrationDate() { // Arrange var mod = _testEnvironmoent.TestModConfigATuple; // Act var resolverFactory = new NuGetUpdateResolverFactory(); NuGetUpdateResolverFactory.SetNowTime(NuGetUpdateResolverFactory.MigrationDate.AddMinutes(-1)); var resolvers = (AggregatePackageResolver)resolverFactory.GetResolver(mod, null, new UpdaterData(new List <string>() { "Sample NuGet Feed" }, new CommonPackageResolverSettings())); // Assert Assert.Equal(1, resolvers.Count); }