public bool IsSame(EventLine line) { //TODO improve this code. Making appropriate "equals" methods in classes EventDescriptor & Event Guard.Against(line == null, "line"); if (_events.Count() != line._events.Count()) return false; for( var i = 0; i < _events.Length; ++i) { var l = _events[i]; var r = line._events[i]; if( l.Coefficient != r.Coefficient || l.Specification != r.Specification || l.Type != r.Type) return false; } return _eventDescriptor.ToString() == line._eventDescriptor.ToString(); }
public void identify_today_lines_with_event() { var pageBuilder = new MaraphoneSoccerPageBuilder() .ExpectedEvents("1", "2", "3", "4") .WithTodayLine("c1", "c2", 1, 2, 3, 4); var champ = pageBuilder.Build(); var line = champ.Lines.First(); var expectedLine = new EventLine("c1-c2", DateTimeOffset.Parse("15:00"), new[] { new MaraphoneEvent("1", 1), new MaraphoneEvent("2", 2), new MaraphoneEvent("3", 3), new MaraphoneEvent("4", 4), }); Assert.IsTrue(line.IsSame(expectedLine), "actual line is differed from expected" ); }