public void BooleanArgument_ParseShouldFail() { // Arrange BooleanArgument argument = new BooleanArgument(); IStringReader reader = new StringReader("hello"); // Act ReadResults readResults = argument.Parse(reader, out _); // Assert Assert.IsFalse(readResults.Successful); }
public void BooleanArgument_UseQuotedText() { // Arrange BooleanArgument argument = new BooleanArgument(); IStringReader reader = new StringReader("'true'"); // Act argument.Parse(reader, out bool result); // Assert Assert.AreEqual(result, true); }
/// <summary> /// Initializes a new instance of the <see cref="TmxToCtf" /> class. /// </summary> /// <param name="Logger"> /// The logger. /// </param> public TmxToCtf(ConsoleLogger Logger) : base(Logger) { TranslationServiceFacade.Initialize(); if (!TranslationServiceFacade.IsTranslationServiceReady()) { this.Logger.WriteLine(LogLevel.Error, "Invalid translation service credentials. Use \"DocumentTranslatorCmd setcredentials\", or use the Document Translator Settings option."); return; } this.TmxDocument = new SimpleStringArgument( "Tmx", true, new[] { ',' }, "TMX Document to upload to CTF."); this.sourceLanguage = new Argument( "From", true, new[] { "Auto-Detect" }, TranslationServiceFacade.AvailableLanguages.Keys.ToArray(), true, "The source language code. Must be a valid Microsoft Translator language code, and the same as language code used in the TMX, or mapped via TmxLangMap.csv (from, to)."); this.targetLanguage = new Argument( "To", true, new string[] { "de" }, TranslationServiceFacade.AvailableLanguages.Keys.ToArray(), true, "The target language code. Must be a valid Microsoft Translator language code, and the same as language code used in the TMX, or mapped via TmxLangMap.csv (from, to)."); this.user = new Argument( "User", false, "The user ID recorded in CTF. Default: TmxUpload."); this.rating = new Argument( "Rating", false, "The rating with which the entries are created. Must be an integer 1..10. 5 or higher overrides MT. Default: 6."); this.boolWrite = new BooleanArgument( "Write", false, false, "Write to CTF."); this.Arguments = new ArgumentList( new[] { this.TmxDocument, this.sourceLanguage, this.targetLanguage, this.user, this.rating, this.boolWrite }, Logger); }