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"]);
    }
Ejemplo n.º 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"]);
        }
        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"]);
        }