public void TestCreateCopyFromPath() { // Output path for testing string targetPath = Path.Combine(testRoot, "test-embedded-config.yaml"); // Create copy of resource within BackupUtilityTest Assert.IsTrue(EmbeddedResource.CreateCopyFromPath(TestConfig.ResourcePath, targetPath)); // Verify file does exist Assert.IsTrue(File.Exists(targetPath)); }
public void TestParseFromYaml() { string targetPath = Path.Combine(testRoot, "test-parse-config.yaml"); // Create copy of local resource EmbeddedResource.CreateCopyFromPath(TestConfig.ResourcePath, targetPath); // Parse newly created file Assert.IsTrue(BackupSettings.TryParseFromYaml(targetPath, out BackupSettings settings)); // Verify parsed file Assert.IsNotNull(settings); Assert.IsTrue(settings.Valid); Assert.AreEqual(Path.GetFileName(targetPath), settings.SettingsFilename); // Compare values to test-config.yaml (embedded resource) Assert.AreEqual(BackupType.Sync, settings.BackupType); Assert.AreEqual(false, settings.IgnoreHiddenFiles); Assert.AreEqual(14, settings.MaxIsololationDays); Assert.AreEqual(@"C:\Target\Test", settings.TargetDirectory); string[] testSource = new string[] { @"C:\Source\Projects", @"C:\Source\Documents" }; CompareArrays(testSource, settings.SourceDirectories); CompareArrays(System.Array.Empty <string>(), settings.ExcludedDirectories); string[] testExcludedDirs = new string[] { "zip" }; CompareArrays(testExcludedDirs, settings.ExcludedFileTypes); }