Пример #1
0
        /// <summary>
        /// Returns true if Event instances are equal
        /// </summary>
        /// <param name="other">Instance of Event to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Event other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TicketEventID == other.TicketEventID ||
                     TicketEventID != null &&
                     TicketEventID.Equals(other.TicketEventID)
                     ) &&
                 (
                     EventName == other.EventName ||
                     EventName != null &&
                     EventName.Equals(other.EventName)
                 ) &&
                 (
                     EventHtmlDescription == other.EventHtmlDescription ||
                     EventHtmlDescription != null &&
                     EventHtmlDescription.Equals(other.EventHtmlDescription)
                 ) &&
                 (
                     EventImagePath == other.EventImagePath ||
                     EventImagePath != null &&
                     EventImagePath.Equals(other.EventImagePath)
                 ));
        }
Пример #2
0
        public bool Matches(object eventIdentifier)
        {
            if (eventIdentifier == null)
            {
                return(false);
            }

            if (eventIdentifier is IStateMachineEvent)
            {
                return(EventName.Equals(((IStateMachineEvent)eventIdentifier).EventName));
            }

            if (eventIdentifier is string)
            {
                return(((string)eventIdentifier).Equals(EventIdentifier.ToString(),
                                                        StringComparison.CurrentCultureIgnoreCase));
            }

            if (EventIdentifier is string)
            {
                return(((string)EventIdentifier).Equals(eventIdentifier.ToString(),
                                                        StringComparison.CurrentCultureIgnoreCase));
            }

            if (eventIdentifier is IComparable)
            {
                return(((IComparable)eventIdentifier).CompareTo(EventIdentifier) == 0);
            }

            return(EventIdentifier.Equals(eventIdentifier));
        }
Пример #3
0
 // Sees if two conditions are equal. Case insensitivity only for groupbname,eventname,action.  Others the case is significant (variables, condition)
 public bool Equals(Condition c, StringComparison ci = StringComparison.InvariantCultureIgnoreCase)
 {
     return(GroupName.HasChars() && GroupName.Equals(c.GroupName, ci) &&          // groupname can be null
            EventName.Equals(c.EventName, ci) &&
            Action.Equals(c.Action, ci) &&
            ActionVars.ToString() == c.ActionVars.ToString() &&
            ToString(false) == c.ToString(false));
 }
		public void Equals_WhenComparingEquivalentValues_ReturnsTrue()
	    {
		    var left = new EventName(SomeTestEvents.TestRequest);
		    var right = new EventName(SomeTestEvents.TestRequest);
			
			bool result = left.Equals(right);
		    Assert.That(result, Is.True);
	    }
        public void Equals_WhenComparingEquivalentValues_ReturnsTrue()
        {
            var left  = new EventName(SomeTestEvents.TestRequest);
            var right = new EventName(SomeTestEvents.TestRequest);

            bool result = left.Equals(right);

            Assert.That(result, Is.True);
        }
Пример #6
0
#pragma warning disable 1591 // Xml Comments
        public override bool Equals(object obj)
        {
            var otherSubscription = obj as EventSubscription;

            if (otherSubscription == null)
            {
                return(false);
            }

            return(Owner.Equals(otherSubscription.Owner) &&
                   Method.Equals(otherSubscription.Method) &&
                   EventName.Equals(otherSubscription.EventName));
        }
Пример #7
0
    public override bool Equals(Object obj)
    {
        //Check whether the compared object is null.
        if (obj == null)
        {
            return(false);
        }

        CSVEvent other = obj as CSVEvent;

        if ((Object)other == null)
        {
            return(false);
        }

        return(EventName.Equals(other.EventName) && YearLevel.Equals(other.YearLevel) &&
               Cost.Equals(other.Cost) && Transport.Equals(other.Transport) && Location.Equals(other.Location) &&
               StartDate.Equals(other.StartDate) && StartTime.Equals(other.StartTime) && FinishDate.Equals(other.FinishDate) &&
               FinishTime.Equals(other.FinishTime) && DaysNotice.Equals(other.DaysNotice) && OtherDetails.Equals(other.OtherDetails));
    }
Пример #8
0
        /// <summary>
        /// Returns true if EventDate instances are equal
        /// </summary>
        /// <param name="other">Instance of EventDate to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(FullEventDate other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     TicketEventDateID == other.TicketEventDateID ||
                     TicketEventDateID != null &&
                     TicketEventDateID.Equals(other.TicketEventDateID)
                     ) &&
                 (
                     TicketEventID == other.TicketEventID ||
                     TicketEventID != null &&
                     TicketEventID.Equals(other.TicketEventID)
                 ) &&
                 (
                     EventName == other.EventName ||
                     EventName != null &&
                     EventName.Equals(other.EventName)
                 ) &&
                 (
                     EventHtmlDescription == other.EventHtmlDescription ||
                     EventHtmlDescription != null &&
                     EventHtmlDescription.Equals(other.EventHtmlDescription)
                 ) &&
                 (
                     EventImagePath == other.EventImagePath ||
                     EventImagePath != null &&
                     EventImagePath.Equals(other.EventImagePath)
                 ) &&
                 (
                     VenueID == other.VenueID ||
                     VenueID != null &&
                     VenueID.Equals(other.VenueID)
                 ) &&
                 (
                     VenueName == other.VenueName ||
                     VenueName != null &&
                     VenueName.Equals(other.VenueName)
                 ) &&
                 (
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     Country == other.Country ||
                     Country != null &&
                     Country.Equals(other.Country)
                 ) &&
                 (
                     EventStartDateTime == other.EventStartDateTime ||
                     EventStartDateTime != null &&
                     EventStartDateTime.Equals(other.EventStartDateTime)
                 ) &&
                 (
                     MaxTickets == other.MaxTickets ||
                     MaxTickets != null &&
                     MaxTickets.Equals(other.MaxTickets)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ));
        }
Пример #9
0
        public EDEvent(string statusJson, string commander, DateTime?timeStamp = null)
        {
            // Initialise from the ED JSON status file

            using (JsonDocument jsonDoc = JsonDocument.Parse(statusJson))
            {
                JsonElement root = jsonDoc.RootElement;
                JsonElement property;

                try
                {
                    if (timeStamp != null)
                    {
                        TimeStamp = ((DateTime)timeStamp).ToUniversalTime();
                    }
                    else if (root.TryGetProperty("timestamp", out property))
                    {
                        TimeStamp = property.GetDateTime();
                    }
                    else
                    {
                        TimeStamp = DateTime.UtcNow;
                    }
                }
                catch
                {
                    TimeStamp = DateTime.UtcNow;
                }

                if (root.TryGetProperty("event", out property))
                {
                    EventName = property.GetString();
                }
                if (EventName.Equals("ShipTargeted"))
                {
                    if (root.TryGetProperty("PilotName", out property))
                    {
                        TargetedShipName = property.GetString();
                    }
                }

                if (root.TryGetProperty("Flags", out property))
                {
                    Flags = property.GetInt64();
                }
                if (root.TryGetProperty("Flags2", out property))
                {
                    Flags2 = property.GetInt64();
                }
                if (root.TryGetProperty("Latitude", out property))
                {
                    Latitude = property.GetDouble();
                }
                if (root.TryGetProperty("Longitude", out property))
                {
                    Longitude = property.GetDouble();
                }
                if (root.TryGetProperty("Altitude", out property))
                {
                    Altitude = property.GetDouble();
                }
                if (root.TryGetProperty("PlanetRadius", out property))
                {
                    PlanetRadius = property.GetDouble();
                }
                if (root.TryGetProperty("Health", out property))
                {
                    Health = property.GetDouble();
                }
                if (root.TryGetProperty("BodyName", out property))
                {
                    BodyName = property.GetString();
                }
                if (root.TryGetProperty("Heading", out property))
                {
                    Heading = property.GetInt16();
                }
                if (root.TryGetProperty("PlayerControlled", out property))
                {
                    PlayerControlled = property.GetBoolean();
                }
                if (root.TryGetProperty("Pips", out property))
                {
                    Pips[0] = property[0].GetByte();
                    Pips[1] = property[1].GetByte();
                    Pips[2] = property[2].GetByte();
                }
                if (EventName.Equals("Synthesis"))
                {
                    if (root.TryGetProperty("Name", out property))
                    {
                        AdditionalData = property.GetString();
                    }
                }
            }
            Commander = commander;
        }
Пример #10
0
 public bool IsType <T>()
     where T : IEvent
 {
     return(EventName.Equals(typeof(T).Name, StringComparison.OrdinalIgnoreCase));
 }
        public override void Execute()
        {
            StartStep();

            //Tune to service
            res = CL.EA.ChannelSurf(EnumSurfIn.Live, noEITService.LCN);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Tune to Channel" + noEITService.LCN);
            }

            //Clear EPG info
            res = CL.IEX.MilestonesEPG.ClearEPGInfo();
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to clear EPG info");
            }

            //Rewind the event
            String pause = CL.EA.GetValueFromINI(EnumINIFile.Project, "RB", "PAUSE");

            res = CL.EA.PVR.SetTrickModeSpeed("RB", Convert.ToDouble(pause), false);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Pause the Event");
            }

            //Wait 60sec
            res = CL.IEX.Wait(60);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Wait for Playback Review Buffer");
            }

            //Playback the event
            String playSpeed = CL.EA.GetValueFromINI(EnumINIFile.Project, "RB", "PLAY");
            Double plySpeed  = Convert.ToDouble(playSpeed);

            res = CL.EA.PVR.SetTrickModeSpeed("RB", plySpeed, false);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Playback the Event");
            }

            CL.IEX.MilestonesEPG.ClearEPGInfo();

            //Launch the Channelbar
            res = CL.IEX.MilestonesEPG.NavigateByName("STATE:CHANNEL BAR");
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Navigate Channel Bar");
            }

            //Check EventName in Channel Bar
            String EventName;

            res = CL.IEX.MilestonesEPG.GetEPGInfo("evtname", out EventName);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Get Event Name From Channel Bar");
            }

            //Check Default EventName for the Event which have NO EIT
            String noEITeventName = CL.EA.GetValueFromINI(EnumINIFile.Project, "EVENT", "LOG_NO_EVT_INFO");

            if (!EventName.Equals(noEITeventName))
            {
                FailStep(CL, res, "Failed to verify that this Event have No EIT");
            }
            LogCommentInfo(CL, "Verified that this Event have No EIT");

            //Waiting for 10 seconds as thumbnail is taking some time to load

            CL.IEX.Wait(10);

            //Check Event Thumbnail in Channel Bar
            String thumbnailName;

            res = CL.IEX.MilestonesEPG.GetEPGInfo("thumbnail", out thumbnailName);
            if (!res.CommandSucceeded)
            {
                FailStep(CL, res, "Failed to Get thumbnail From Channel Bar");
            }
            if (string.IsNullOrEmpty(thumbnailName))
            {
                FailStep(CL, "Thumbnail value fecthed from EPG is null");
            }

            //Check Default Thumbnail for the Event which have no EIT
            String thumbnailDefault = CL.EA.GetValueFromINI(EnumINIFile.Project, "THUMBNAIL", "DEFAULT");

            if (thumbnailName.Equals(thumbnailDefault))
            {
                LogCommentImportant(CL, "Thumbnail for NO EIT is same as Default Thumbnail " + thumbnailDefault);
            }
            else
            {
                FailStep(CL, "Thumbnail Fetched for No EIT event " + thumbnailName + " is different from " + thumbnailDefault);
            }
            //Check Default Thumbnail for the Event which have no EIT
            // String thumbnailDefault = CL.EA.GetValueFromINI(EnumINIFile.Project, "THUMBNAIL", "DEFAULT");

            // if (thumbnailName.Equals(thumbnailDefault))
            // {
            //     FailStep(CL, res, "Failed to verify that this Event have Default thumbnail");
            // }
            LogCommentInfo(CL, "Verified that this Event have Default Thumbnail");

            PassStep();
        }