Пример #1
0
        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"]);
        }
Пример #2
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"]);
        }