public void DriveSwitchSupported(IPromptStrategy strategy)
 {
     if (Regex.IsMatch(strategy.CommandLine, @"\bcmd.exe\b"))
     {
         // "cd" in other prompts like PowerShell don't use /d
         Assert.IsTrue(Regex.IsMatch(strategy.CommandLine, @"\bcd /d\b"), String.Format("The strategy {0} doesn't switch drives.", strategy.Id));
     }
 }
 public void StandardPropertiesPopulated(IPromptStrategy strategy)
 {
     Assert.IsNotNullOrEmpty(strategy.Accelerator, "The accelerator text should not be null or empty.");
     Assert.IsTrue(strategy.Accelerator.Contains('&'), "The accelerator text should contain a hotkey designated.");
     Assert.IsNotNullOrEmpty(strategy.CommandLine, "The command line should not be null or empty.");
     Assert.IsNotNullOrEmpty(strategy.Id, "The ID should not be null or empty.");
     Assert.IsNotNullOrEmpty(strategy.Name, "The name should not be null or empty.");
 }
 public void StrategyValuesUnique(IPromptStrategy strategy)
 {
     Assert.IsFalse(this._acceleratorsFound.Contains(strategy.Accelerator), String.Format("The accelerator key {0} is a duplicate.", strategy.Accelerator));
     Assert.IsFalse(this._idsFound.Contains(strategy.Id), String.Format("The ID {0} is a duplicate.", strategy.Id));
     Assert.IsFalse(this._namesFound.Contains(strategy.Name), String.Format("The prompt name {0} is a duplicate.", strategy.Name));
     this._acceleratorsFound.Add(strategy.Accelerator);
     this._idsFound.Add(strategy.Id);
     this._namesFound.Add(strategy.Name);
 }
Example #4
0
 /// <summary>
 /// Builds an .INF file for installing a command prompt strategy.
 /// </summary>
 /// <param name="strategy">
 /// The <see cref="CommandPromptHereGen.PromptStrategies.IPromptStrategy"/>
 /// for which the .INF file should be built.
 /// </param>
 /// <returns>
 /// An .INF file that should be able to install the command prompt.
 /// </returns>
 public static string Build(IPromptStrategy strategy)
 {
     return String.Format(
         CultureInfo.InvariantCulture,
         Properties.Resources.InfTemplate,
         strategy.Id,
         strategy.Name,
         strategy.Accelerator,
         strategy.CommandLine.InfEncode());
 }