コード例 #1
0
        private void RunTest(IDataProvider provider,
                             IEnumerable <IMap> mappings)
        {
            var source    = provider.GetSource();
            var converted = _translater.Translate(source,
                                                  mappings);

            Compare(converted,
                    provider.GetExpected());
        }
コード例 #2
0
        public TranslaterModule(ITranslater <TranslateRequest, TranslateResponse> translater) : base("/translate")
        {
            _translaterService = translater;

            Post["/"] = (parameters) =>
            {
                var data = this.Bind <TranslateRequest>();
                if (data.Text == string.Empty)
                {
                    return new TranslateResponse {
                               Text = new string[] { "" }
                    }
                }
                ;
                var res = _translaterService.Translate(data).Result;

                return(res);
            };

            Get["/check"] = _ => ((ApiClientCommon)_translaterService).HealthCheck();
        }
    }