public void DoNotHaveOverlappingAssociationsWithTheSameStpIndicator()
        {
            var everydayIn2019 =
                TestSchedules.CreateEverydayCalendar(new DateTime(2019, 1, 1), new DateTime(2019, 12, 31));
            var service     = TestSchedules.CreateScheduleWithService("A12345").Service;
            var association = TestAssociations.CreateAssociation(mainUid: "A12345", associatedUid: "A67890");
            var overlapping = TestAssociations.CreateAssociation(mainUid: "A12345", associatedUid: "A67890", calendar: everydayIn2019);

            service.AddAssociation(association, true);
            service.AddAssociation(overlapping, true);

            Assert.False(service.HasAssociations());
            var associations = service.GetAssociations();

            Assert.Empty(associations);
        }
Exemple #2
0
        public void AddMultipleVersionsOfAnAssociationToServices()
        {
            var timetable = CreateTimetable();

            TestSchedules.CreateScheduleInTimetable(timetable, "X12345");
            TestSchedules.CreateScheduleInTimetable(timetable, "A98765");

            var associations = new [] {
                TestAssociations.CreateAssociation("X12345", "A98765", StpIndicator.Permanent),
                TestAssociations.CreateAssociation("X12345", "A98765", StpIndicator.Override),
                TestAssociations.CreateAssociation("X12345", "A98765",
                                                   calendar: TestSchedules.CreateEverydayCalendar(new DateTime(2019, 9, 1), new DateTime(2019, 9, 30)))
            };

            var count = timetable.AddAssociations(associations);

            Assert.Equal(3, count);
            var service = timetable.GetService("X12345");

            Assert.Single(service.GetAssociations());
        }