Esempio n. 1
0
        public ClockModel()
        {
            var now = DateTime.Now;

            this.Time = now.Hour.ToString("00") + ":" + now.Minute.ToString("00");
            this.Date = EnglishTranslator.TranslateToHr(now.DayOfWeek.ToString()) + " " + now.ToShortDateString();
        }
Esempio n. 2
0
 public WeatherDayData(WeatherForecast forecast)
 {
     this.Day            = EnglishTranslator.TranslateToHr(forecast.Day);
     this.TemperatureMin = $"{forecast.TempMin}°";
     this.TemperatureMax = $"{forecast.TempMax}°";
     this.Forecast       = EnglishTranslator.TranslateToHr(forecast.Text);
     this.ForecastImage  = "/Content/Images/Weather/" + forecast.Code.ToString("00") + ".png";
 }
Esempio n. 3
0
        public WeatherModel()
        {
            this.City = Utils.ReadWebConfigAppSettings <string>("WeatherForecastCity");
            int woeId = Utils.ReadWebConfigAppSettings <int>("WeatherForecastWoeid");

            this.data = new WeatherData(woeId, 5);

            this.CurrentTemperature    = this.data.Temperature.ToString() + "°";
            this.CurrentCondition      = EnglishTranslator.TranslateToHr(this.data.Text);
            this.CurrentConditionImage = "/Content/Images/Weather/" + this.data.Code.ToString("00") + ".png";
            this.Forecasts             = this.data.Forecasts.Skip(1).Select(fc => new WeatherDayData(fc)).ToList();
        }
        public void EnglishTranslator()
        {
            var english  = new EnglishTranslator();
            var director = new MultiLanguageTranslator(english);

            director.Translate("hey");

            var translation = english.GetTranslation();

            Assert.AreEqual(translation.SpeechDifficulty, 5);
            Assert.AreEqual(translation.SpeechVelocity, 15);
            Assert.AreEqual(translation.TranslatedWord, "english hey");
        }