Exemple #1
0
        public void SportEventConditionsTest()
        {
            var venue1 = new venue
            {
                id                = "sr:venue:1",
                capacity          = 1,
                capacitySpecified = true,
                city_name         = "my city",
                country_name      = "my country",
                map_coordinates   = "coordinates",
                name              = "venue name",
            };

            var weatherInfo1 = new weatherInfo
            {
                pitch = "my pitch",
                temperature_celsius          = 40,
                temperature_celsiusSpecified = true,
                weather_conditions           = "my weather conditions",
                wind           = "strong",
                wind_advantage = "none"
            };

            var sportEventConditionType = new sportEventConditions
            {
                attendance = "all",
                match_mode = "full mode",
                referee    = new referee
                {
                    id          = "sr:referee:1",
                    name        = "John Doe",
                    nationality = "German",
                },
                venue        = venue1,
                weather_info = weatherInfo1
            };

            var sportEventConditionsDTO = new SportEventConditionsDTO(sportEventConditionType);
            var sportEventConditionsCI  = new SportEventConditionsCI(sportEventConditionsDTO, _cultureFirst);

            Assert.IsNotNull(sportEventConditionsCI);
            Assert.AreEqual(sportEventConditionType.attendance, sportEventConditionsCI.Attendance);
            Assert.AreEqual(sportEventConditionType.match_mode, sportEventConditionsCI.EventMode);
            Assert.AreEqual(sportEventConditionType.referee.id, sportEventConditionsCI.Referee.Id.ToString());
            Assert.AreEqual(sportEventConditionType.referee.name, sportEventConditionsCI.Referee.Name);
            Assert.AreEqual(sportEventConditionType.referee.nationality, sportEventConditionsCI.Referee.GetNationality(_cultureFirst));

            //Assert.AreEqual(sportEventConditionType.venue.id, sportEventConditionsCI.); TODO: missing Venue

            Assert.AreEqual(sportEventConditionType.weather_info.pitch, sportEventConditionsCI.WeatherInfo.Pitch);
            Assert.AreEqual(sportEventConditionType.weather_info.temperature_celsius, sportEventConditionsCI.WeatherInfo.TemperatureCelsius);
            Assert.AreEqual(sportEventConditionType.weather_info.weather_conditions, sportEventConditionsCI.WeatherInfo.WeatherConditions);
            Assert.AreEqual(sportEventConditionType.weather_info.wind, sportEventConditionsCI.WeatherInfo.Wind);
            Assert.AreEqual(sportEventConditionType.weather_info.wind_advantage, sportEventConditionsCI.WeatherInfo.WindAdvantage);
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WeatherInfoDTO"/> class.
        /// </summary>
        /// <param name="weatherInfo">The <see cref="weatherInfo"/> used for creating instance</param>
        internal WeatherInfoDTO(weatherInfo weatherInfo)
        {
            Contract.Requires(weatherInfo != null);

            TemperatureCelsius = weatherInfo.temperature_celsiusSpecified
                ? (int?)weatherInfo.temperature_celsius
                : null;
            Wind              = weatherInfo.wind;
            WindAdvantage     = weatherInfo.wind_advantage;
            Pitch             = weatherInfo.pitch;
            WeatherConditions = weatherInfo.weather_conditions;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WeatherInfoDTO"/> class.
        /// </summary>
        /// <param name="weatherInfo">The <see cref="weatherInfo"/> used for creating instance</param>
        internal WeatherInfoDTO(weatherInfo weatherInfo)
        {
            Guard.Argument(weatherInfo, nameof(weatherInfo)).NotNull();

            TemperatureCelsius = weatherInfo.temperature_celsiusSpecified
                ? (int?)weatherInfo.temperature_celsius
                : null;
            Wind              = weatherInfo.wind;
            WindAdvantage     = weatherInfo.wind_advantage;
            Pitch             = weatherInfo.pitch;
            WeatherConditions = weatherInfo.weather_conditions;
        }
        public static weatherInfo GetWeatherInfo()
        {
            var msg = new weatherInfo
            {
                pitch = SR.S1000,
                temperature_celsius          = SR.I100,
                temperature_celsiusSpecified = true,
                weather_conditions           = SR.S1000,
                wind_advantage = SR.S1000,
                wind           = SR.S1000,
            };

            return(msg);
        }
Exemple #5
0
        public void WeatherInfoTest()
        {
            var weatherInfo = new weatherInfo
            {
                pitch = "my pitch",
                temperature_celsius          = 40,
                temperature_celsiusSpecified = true,
                weather_conditions           = "my weather conditions",
                wind           = "strong",
                wind_advantage = "none"
            };
            var weatherInfoDTO = new WeatherInfoDTO(weatherInfo);
            var weatherInfoCI  = new WeatherInfoCI(weatherInfoDTO);

            Assert.IsNotNull(weatherInfoCI);
            Assert.AreEqual(weatherInfo.pitch, weatherInfoCI.Pitch);
            Assert.AreEqual(weatherInfo.temperature_celsius, weatherInfoCI.TemperatureCelsius);
            Assert.AreEqual(weatherInfo.weather_conditions, weatherInfoCI.WeatherConditions);
            Assert.AreEqual(weatherInfo.wind, weatherInfoCI.Wind);
            Assert.AreEqual(weatherInfo.wind_advantage, weatherInfoCI.WindAdvantage);
        }