Example #1
0
        /// <summary>
        /// Merges the specified event summary
        /// </summary>
        /// <param name="eventSummary">The event summary</param>
        /// <param name="culture">The culture</param>
        private void ActualMerge(CompetitionDTO eventSummary, CultureInfo culture)
        {
            base.Merge(eventSummary, culture, false);

            if (eventSummary.Venue != null)
            {
                if (_venue == null)
                {
                    _venue = new VenueCI(eventSummary.Venue, culture);
                }
                else
                {
                    _venue.Merge(eventSummary.Venue, culture);
                }
            }
            if (eventSummary.Conditions != null)
            {
                if (_conditions == null)
                {
                    _conditions = new SportEventConditionsCI(eventSummary.Conditions, culture);
                }
                else
                {
                    _conditions.Merge(eventSummary.Conditions, culture);
                }
            }
            if (eventSummary.Competitors != null)
            {
                Competitors = new List <URN>(eventSummary.Competitors.Select(t => t.Id));
                GenerateMatchName(eventSummary.Competitors, culture);
                FillCompetitorsQualifiers(eventSummary.Competitors);
                FillCompetitorsReferences(eventSummary.Competitors);
                FillCompetitorsVirtual(eventSummary.Competitors);
            }
            if (eventSummary.BookingStatus != null)
            {
                _bookingStatus = eventSummary.BookingStatus;
            }
            if (!string.IsNullOrEmpty(eventSummary.LiveOdds))
            {
                _liveOdds = eventSummary.LiveOdds;
            }
            if (eventSummary.Type != null)
            {
                _sportEventType = eventSummary.Type;
            }
            if (eventSummary.StageType != null)
            {
                _stageType = eventSummary.StageType;
            }
        }
Example #2
0
        public void VenueMergeTest()
        {
            var venue1 = new venue
            {
                id                = SR.Urn("venue").ToString(),
                capacity          = 5,
                capacitySpecified = true,
                city_name         = "my city",
                country_name      = "eng country name",
                state             = "state",
                map_coordinates   = "coordinates",
                name              = "eng name"
            };
            var venue2 = new venue
            {
                id                = SR.Urn("venue").ToString(),
                capacity          = 5,
                capacitySpecified = true,
                city_name         = "my city",
                country_name      = "de country name",
                state             = "state",
                map_coordinates   = "coordinates",
                name              = "eng name"
            };
            var venueDTO1 = new VenueDTO(venue1);
            var venueDTO2 = new VenueDTO(venue2);
            var venueCI   = new VenueCI(venueDTO1, _cultureFirst);

            venueCI.Merge(venueDTO2, _cultureSecond);

            Assert.IsNotNull(venueCI);
            Assert.AreEqual(venue1.id, venueCI.Id.ToString());
            Assert.AreEqual(venue1.name, venueCI.GetName(_cultureFirst));
            Assert.AreEqual(venue1.capacity, venueCI.Capacity);
            Assert.AreEqual(venue1.map_coordinates, venueCI.Coordinates);
            Assert.AreEqual(venue1.state, venueCI.State);
            Assert.AreEqual(venue1.city_name, venueCI.GetCity(_cultureFirst));
            Assert.AreEqual(venue1.country_name, venueCI.GetCountry(_cultureFirst));
            Assert.AreEqual(venue2.country_name, venueCI.GetCountry(_cultureSecond));
            Assert.AreNotEqual(venueCI.GetCountry(_cultureFirst), venueCI.GetCountry(_cultureSecond));
        }