Ejemplo n.º 1
0
 public Journey(JourneyDto journey)
 {
     DepartureTime = journey.DepartureTime;
     ArrivalTime   = journey.ArrivalTime;
     Duration      = TimeSpan.FromTicks(journey.Duration);
     Legs          = journey.Legs.Select(l => new Leg(l)).ToList();
 }
Ejemplo n.º 2
0
        public async Task TestInitialize()
        {
            var result = await TagsControllerTestsHelper.GetAllTagsAsync(
                UserType.Preserver, TestFactory.PlantWithAccess,
                TestFactory.ProjectWithAccess);

            Assert.IsNotNull(result);

            InitialTagsCount = result.MaxAvailable;
            Assert.IsTrue(InitialTagsCount > 0, "Bad test setup: Didn't find any tags at startup");
            Assert.AreEqual(InitialTagsCount, result.Tags.Count);

            var journeys = await JourneysControllerTestsHelper.GetJourneysAsync(UserType.LibraryAdmin, TestFactory.PlantWithAccess);

            TwoStepJourneyWithTags = journeys.Single(j => j.Title == KnownTestData.TwoStepJourneyWithTags);

            TagIdUnderTest_ForStandardTagReadyForBulkPreserve_NotStarted
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForStandardTagReadyForBulkPreserve_NotStarted;
            TagIdUnderTest_ForStandardTagWithAttachmentRequirement_Started
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForStandardTagWithAttachmentRequirement_Started;
            TagIdUnderTest_ForStandardTagWithInfoRequirement_Started
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForStandardTagWithInfoRequirement_Started;
            TagIdUnderTest_ForStandardTagWithCbRequirement_Started
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForStandardTagWithCbRequirement_Started;
            TagIdUnderTest_ForSiteAreaTagReadyForBulkPreserve_NotStarted
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForSiteAreaTagReadyForBulkPreserve_NotStarted;

            TagIdUnderTest_ForStandardTagWithAttachmentsAndActionAttachments_Started
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForStandardTagWithAttachmentsAndActionAttachments_Started;
            TagIdUnderTest_ForSiteAreaTagWithAttachmentsAndActionAttachments_NotStarted
                = TestFactory.Instance.SeededData[KnownPlantData.PlantA].TagId_ForSiteAreaTagWithAttachmentsAndActionAttachments_NotStarted;

            TestFactory.Instance
            .DisciplineApiServiceMock
            .Setup(service => service.TryGetDisciplineAsync(TestFactory.PlantWithAccess, KnownDisciplineCode))
            .Returns(Task.FromResult(new PCSDiscipline
            {
                Code = KnownDisciplineCode, Description = $"{KnownDisciplineCode} - Description"
            }));

            TestFactory.Instance
            .AreaApiServiceMock
            .Setup(service => service.TryGetAreaAsync(TestFactory.PlantWithAccess, KnownAreaCode))
            .Returns(Task.FromResult(new PCSArea
            {
                Code = KnownAreaCode, Description = $"{KnownAreaCode} - Description"
            }));
        }