Пример #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            CanonicalEvent canonicalEvent = obj as CanonicalEvent;

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

            if (ExperimentId != canonicalEvent.ExperimentId ||
                VariationId != canonicalEvent.VariationId ||
                EventName != canonicalEvent.EventName ||
                VisitorId != canonicalEvent.VisitorId)
            {
                return(false);
            }

            if (!Attributes.OrderBy(pair => pair.Key)
                .SequenceEqual(canonicalEvent.Attributes.OrderBy(pair => pair.Key)))
            {
                return(false);
            }

            if (!Tags.OrderBy(pair => pair.Key)
                .SequenceEqual(canonicalEvent.Tags.OrderBy(pair => pair.Key)))
            {
                return(false);
            }

            return(true);
        }
        private void Expect(string experimentId, string variationId, string eventName, string visitorId, UserAttributes attributes, EventTags tags)
        {
            var expectedEvent = new CanonicalEvent(experimentId, variationId, eventName, visitorId, attributes, tags);

            ExpectedEvents.Add(expectedEvent);
        }