public void Set_Empty() { var dest = new SettingsFolder(); dest.Set(new ArgumentCollection(new string[0], '/', true)); Assert.That(dest.MachineName, Is.EqualTo(Environment.MachineName)); Assert.That(dest.UserName, Is.EqualTo(Environment.UserName)); Assert.That(dest.DocumentName.Name, Is.EqualTo("CubePDF")); Assert.That(dest.Value.DeleteSource, Is.False); Assert.That(dest.Value.Source, Is.Empty); }
/* ----------------------------------------------------------------- */ /// /// Create /// /// <summary> /// SettingsFolder オブジェクトを生成します。 /// </summary> /// /// <param name="args">プログラム引数一覧</param> /// /// <returns>SettingsFolder</returns> /// /* ----------------------------------------------------------------- */ protected SettingsFolder Create(string[] args) { var path = $@"CubeSoft\CubePDF\{GetType().Name}"; var dest = new SettingsFolder(DataContract.Format.Registry, path, IO) { WorkDirectory = GetResultsWith("Tmp"), }; dest.Load(); dest.Value.Destination = Results; dest.Set(new ArgumentCollection(args, '/', true)); return(dest); }
public void Set() { var src = new[] { "/DeleteOnClose", "/SkipUI", "/DocumentName", "(234)?File.txt - Sample Application", "/InputFile", @"C:\WINDOWS\CubePDF\PS3AEE.tmp", "/MachineName", @"\\APOLLON", "/ThreadID", "15180", "/UserName", "clown", "/Exec", @"C:\Program Files\CubePDF\cubepdf.exe", }; var dest = new SettingsFolder(); dest.Set(new ArgumentCollection(src, '/', true)); var path = System.IO.Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.Desktop), System.IO.Path.ChangeExtension(dest.DocumentName.Name, ".pdf") ); Assert.That(dest.MachineName, Is.EqualTo(@"\\APOLLON")); Assert.That(dest.UserName, Is.EqualTo("clown")); Assert.That(dest.DocumentName.Value, Is.EqualTo("(234)?File.txt - Sample Application")); Assert.That(dest.DocumentName.Name, Is.EqualTo("(234)_File.txt")); Assert.That(dest.Value.DeleteSource, Is.True); Assert.That(dest.Value.SkipUi, Is.True); Assert.That(dest.Value.Source, Is.EqualTo(@"C:\WINDOWS\CubePDF\PS3AEE.tmp")); Assert.That(dest.Value.Destination, Is.EqualTo(path)); }