public void PlainText_Method()
    {
      Assert.Throws<ArgumentNullException>(() => ITranslationRequestExtensions.PlainText(null));

      var request = new TranslationRequest();
      Assert.False(request.Parameters.ContainsKey("format"));
      Assert.True(ReferenceEquals(request, request.PlainText()));
      Assert.Equal("plain", request.Parameters["format"]);
    }
    public void Text_Method()
    {
      Assert.Throws<ArgumentNullException>(() => new TranslationRequest().Text(null));
      Assert.Throws<ArgumentException>(() => new TranslationRequest().Text(string.Empty));

      var request = new TranslationRequest();
      Assert.False(request.Parameters.ContainsKey("text"));
      Assert.True(ReferenceEquals(request, request.Text("text")));
      Assert.Equal("text", request.Parameters["text"]);
    }
    public void To_Method()
    {
      Assert.Throws<ArgumentNullException>(() => ITranslationRequestExtensions.To(null, CultureInfo.InvariantCulture));

      var request = new TranslationRequest();
      Assert.False(request.Parameters.ContainsKey("lang"));
      Assert.True(ReferenceEquals(request, request.To(CultureInfo.GetCultureInfo("ru"))));
      Assert.Equal("ru", request.Parameters["lang"]);
      Assert.Equal("en-ru", request.From(CultureInfo.GetCultureInfo("en")).Parameters["lang"]);
    }
    public void To_Method()
    {
      Assert.Throws<ArgumentNullException>(() => new TranslationRequest().To(null));
      Assert.Throws<ArgumentException>(() => new TranslationRequest().To(string.Empty));

      var request = new TranslationRequest();
      Assert.False(request.Parameters.ContainsKey("lang"));
      Assert.True(ReferenceEquals(request, request.To("to")));
      Assert.Equal("to", request.Parameters["lang"]);
      Assert.Equal("from-to", request.From("from").Parameters["lang"]);
    }
 public void Constructors()
 {
   var request = new TranslationRequest();
   Assert.False(request.Parameters.Any());
 }
        public void Constructors()
        {
            var request = new TranslationRequest();

            Assert.False(request.Parameters.Any());
        }
示例#7
0
        public void Constructors()
        {
            var request = new TranslationRequest();

            Assert.Empty(request.Parameters);
        }