void CreateOptions() { var properties = new Properties(); fakeSettings = new FakeSettings(); options = new PackageManagementOptions(properties, fakeSettings); }
public void SetUp() { fakeSettings = new FakeSettings(); projectService = new FakePackageManagementProjectService(); SettingsProvider.LoadDefaultSettings = LoadDefaultSettings; settingsProvider = new SettingsProvider(projectService); }
void CreateOneRegisteredPackageSource() { Properties properties = new Properties(); Options = new TestablePackageManagementOptions(); FakeSettings = Options.FakeSettings; AddOnePackageSource(); }
void CreateOptions() { var properties = new Properties(); var projectService = new FakePackageManagementProjectService(); fakeSettings = new FakeSettings(); SettingsProvider settingsProvider = TestablePackageManagementOptions.CreateSettingsProvider(fakeSettings, projectService); options = new PackageManagementOptions(properties, settingsProvider); }
public TestablePackageManagementOptions( Properties properties, FakeSettings fakeSettings, FakePackageManagementProjectService projectService) : base(properties, CreateSettingsProvider(fakeSettings, projectService)) { this.Properties = properties; this.FakeSettings = fakeSettings; this.ProjectService = projectService; }
public void UploadResultPdfFileTest() { var logger = new NLogLogManager().GetLogger("Upload"); var setting = new FakeSettings(); var strinname = Directory.GetParent("//download//Reports//pdf//09-08-2015"); var processFtp = new ProcessFtp(logger, setting.HcpNvSftpHost, setting.HcpNvSftpUserName, setting.HcpNvSftpPassword); var destinationPathOnSftp = (!string.IsNullOrEmpty(setting.HcpNvSftpResultReportDownloadPath) ? setting.HcpNvSftpResultReportDownloadPath + "/" : string.Empty) + "IncorrectPhoneNumber"; processFtp.UploadSingleFile(@"F:\test.pdf", destinationPathOnSftp, ("test_20170828" + ".pdf")); //processFtp.DownloadFiles(setting.HcpNvLockCorporateEventFolderLocation + "/HomeVisitRequest", @"F:\SFTP\HCP NV\HomeVisitRequest"); // processFtp.UploadSingleFile(@"D:\Projects\Falcon\branches\QA\src\UI\media.falcon.com\ResultPacket\39786\PremiumVersion\847108\PcpResultReport.pdf", @"download\Reports\pdf\09-08-2015", ("999988" + ".pdf")); }
public void PackageSources_UpdateActivePackageSourceWhenNuGetConfigAccessIsUnauthorized_DoesNotThrowException() { CreateProperties(); fakeSettings = new FakeReadOnlySettings(); CreateSettingsProvider(fakeSettings); SettingsProvider.LoadDefaultSettings = (fileSystem, configFile, machineSettings) => { throw new UnauthorizedAccessException(); }; CreateOptions(properties, settingsProvider); var packageSource = new PackageSource("http://test.com"); Assert.DoesNotThrow(() => options.ActivePackageSource = packageSource); }
public void SettingsSourceAllowsResolvingOfSettingClasses() { var builder = new ContainerBuilder(); var reader = new FakeReader(); builder.RegisterInstance(reader).As<ISettingsReader>(); builder.RegisterSource(new SettingsSource()); var container = builder.Build(); var fakeSettings = new FakeSettings(); reader.Settings = fakeSettings; var resolvedSettings = container.Resolve<FakeSettings>(); Assert.AreSame(fakeSettings, resolvedSettings); Assert.IsTrue(reader.WasCalled); }
void CreateViewModel() { var properties = new Properties(); var settings = new FakeSettings(); var options = new PackageManagementOptions(properties, settings); packageSources = options.PackageSources; packageSources.Clear(); var cache = new PackageRepositoryCache(packageSources, new RecentPackageInfo [0]); registeredRepositories = new RegisteredPackageRepositories(cache, options); viewModel = new RegisteredPackageSourcesViewModel(registeredRepositories); }
public override IEnumerable <(string, string, string, ISettings)> Create() { var sortAndRemoveDocumentation = new FakeSettings { SortEntries = true, RemoveDocumentationComment = true }; yield return("Culture should not impact sorting", "InvariantCulture.resx", "et", sortAndRemoveDocumentation); yield return("Additional xml comments are kept.", "AdditionalXmlComments.resx", null, sortAndRemoveDocumentation); yield return("Comment is removed even if no sorting is required.", "AlreadySorted.resx", null, sortAndRemoveDocumentation); yield return("Data nodes appear after meta data nodes.", "Mixed.resx", null, sortAndRemoveDocumentation); yield return("Entries are sorted alphabetically.", "Sort.resx", null, sortAndRemoveDocumentation); yield return("File remains untouched if no modification is necessary.", "NoModificationNeeded.resx", null, sortAndRemoveDocumentation); // TODO xml comments should retain their original position yield return("Invalid resx files are not touched.", "InvalidResx.resx", null, sortAndRemoveDocumentation); yield return("Meta data is sorted too.", "MetaData.resx", null, sortAndRemoveDocumentation); yield return("Plain xml files are not touched.", "Plain.xml", null, sortAndRemoveDocumentation); yield return("Comment nodes are kept.", "WithResxComments.resx", null, sortAndRemoveDocumentation); yield return("Entries are only sorted if 'sort' setting is active.", "DoNotSort.resx", null, new FakeSettings { SortEntries = false, RemoveDocumentationComment = true }); yield return("Documentation is only removed if 'doc' setting is active.", "KeepComments.resx", null, new FakeSettings { SortEntries = true, RemoveDocumentationComment = false }); yield return("Documentation is only removed if 'doc' setting is active.", "DoNothing.resx", null, new FakeSettings { SortEntries = false, RemoveDocumentationComment = false }); }
public void SaveLoad_PropertiesMatch() { FileInfo file = new FileInfo(Path.Combine(Path.GetTempPath(), $"{nameof(SettingsFileManagerTests)}.{nameof(this.SaveLoad_PropertiesMatch)}.xml")); try { SettingsFileManager <FakeSettings> settingsManager = new SettingsFileManager <FakeSettings>(file); settingsManager.Settings.NewProperty = "foo"; settingsManager.Settings.IsAwesome = true; settingsManager.Settings.Title = "hello"; FakeSettings savedSettings = settingsManager.Settings; settingsManager.Save(); FakeSettings loadedSettings = new SettingsFileManager <FakeSettings>(file).Settings; Assert.AreEqual(savedSettings.NewProperty, loadedSettings.NewProperty); Assert.AreEqual(savedSettings.IsAwesome, loadedSettings.IsAwesome); Assert.AreEqual(savedSettings.Title, loadedSettings.Title); } finally { try { file.Delete(); } catch { } } }
void CreateSettings() { settingsProvider = new FakeSettingsProvider(); settings = settingsProvider.FakeSettings; }
void CreateOptions() { options = new TestablePackageManagementOptions(); settings = options.FakeSettings; }
public static SettingsProvider CreateSettingsProvider(FakeSettings fakeSettings, FakePackageManagementProjectService projectService) { ChangeSettingsReturnedBySettingsProvider(fakeSettings); return(new SettingsProvider(projectService)); }
public static void ChangeSettingsReturnedBySettingsProvider(FakeSettings settings) { SettingsProvider.LoadDefaultSettings = (fileSystem, configFile, machineSettings) => { return(settings); }; }
void CreateOptions(FakeSettings fakeSettings) { CreateProperties(); options = new PackageManagementOptions(properties, fakeSettings); }
void CreateOptions(Properties properties, FakeSettings fakeSettings) { options = new PackageManagementOptions(properties, fakeSettings); }
void CreateSettings() { fakeSettings = new FakeSettings(); }
void CreateOptions(Properties properties, FakeSettings fakeSettings) { CreateSettingsProvider(fakeSettings); options = new PackageManagementOptions(properties, settingsProvider); }
void ChangeSettingsReturnedBySettingsProvider() { fakeSettings = new FakeSettings(); TestablePackageManagementOptions.ChangeSettingsReturnedBySettingsProvider(fakeSettings); }
void CreateSettingsProvider(FakeSettings fakeSettings) { projectService = new FakePackageManagementProjectService(); settingsProvider = TestablePackageManagementOptions.CreateSettingsProvider(fakeSettings, projectService); }
public TestablePackageManagementOptions(Properties properties, FakeSettings fakeSettings) : base(properties, fakeSettings) { this.Properties = properties; this.FakeSettings = fakeSettings; }