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"]);
    }
コード例 #2
0
    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"]);
    }
コード例 #3
0
        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"]);
        }
コード例 #4
0
        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"]);
        }