public void CertificateFromStore_Success_ParsedAndAddedToAssociatedPackageSource() { using (var testInfo = new TestInfo()) { // Arrange testInfo.SetupCertificateInStorage(); // Act var settings = testInfo.LoadSettingsFromConfigFile(); var clientCertificateProvider = new ClientCertificateProvider(settings); clientCertificateProvider.AddOrUpdate(new StoreClientCertItem(testInfo.PackageSourceName, testInfo.CertificateFindValue.ToString(), testInfo.CertificateStoreLocation, testInfo.CertificateStoreName, testInfo.CertificateFindBy)); // Assert var packageSourceProvider = new PackageSourceProvider(settings); var packageSourceList = packageSourceProvider.LoadPackageSources().ToList(); Assert.Equal(1, packageSourceList.Count); Assert.Equal(1, packageSourceList[0].ClientCertificates.Count); Assert.Equal(testInfo.Certificate, packageSourceList[0].ClientCertificates[0]); } }
public void CertificateFromFile_Success_ParsedAndAddedToAssociatedPackageSource() { using (var testInfo = new TestInfo()) { // Arrange testInfo.SetupCertificateFile(); // Act var settings = testInfo.LoadSettingsFromConfigFile(); var clientCertificateProvider = new ClientCertificateProvider(settings); clientCertificateProvider.AddOrUpdate(new FileClientCertItem(testInfo.PackageSourceName, testInfo.CertificateAbsoluteFilePath, testInfo.CertificatePassword, false, testInfo.ConfigFile)); // Assert var packageSourceProvider = new PackageSourceProvider(settings); var packageSourceList = packageSourceProvider.LoadPackageSources().ToList(); Assert.Equal(1, packageSourceList.Count); Assert.Equal(1, packageSourceList[0].ClientCertificates.Count); Assert.Equal(testInfo.Certificate, packageSourceList[0].ClientCertificates[0]); } }