Ejemplo n.º 1
0
        public CrossSectionSurvey MapCrossSection(Model.CrossSectionSurvey crossSectionSurvey)
        {
            var unitSystem = CreateUnitSystemWithRequiredUnits(crossSectionSurvey);

            var crossSectionSurveyFactory = new CrossSectionSurveyFactory(unitSystem)
            {
                DefaultChannelName          = crossSectionSurvey.GetFieldValueWithDefault(Channel, CrossSectionParserConstants.DefaultChannelName),
                DefaultRelativeLocationName = crossSectionSurvey.GetFieldValueWithDefault(RelativeLocation, CrossSectionParserConstants.DefaultRelativeLocationName),
                DefaultStartPointType       = crossSectionSurvey.GetFieldValue(StartBank).ToStartPointType()
            };

            var startTime    = crossSectionSurvey.GetFieldValue(StartDate).ToDateTimeOffset();
            var endTime      = crossSectionSurvey.GetFieldValue(EndDate).ToDateTimeOffset();
            var surveyPeriod = new DateTimeInterval(startTime, endTime);


            var newCrossSectionSurvey = crossSectionSurveyFactory.CreateCrossSectionSurvey(surveyPeriod);

            newCrossSectionSurvey.StageMeasurement = CreateStageMeasurement(crossSectionSurvey, unitSystem);

            newCrossSectionSurvey.Party    = crossSectionSurvey.GetFieldValue(Party);
            newCrossSectionSurvey.Comments = crossSectionSurvey.GetFieldValue(Comment);

            newCrossSectionSurvey.CrossSectionPoints = _crossSectionPointMapper.MapPoints(crossSectionSurvey.Points);

            return(newCrossSectionSurvey);
        }
        public void TestSetup()
        {
            _fixture = new Fixture();

            _crossSectionPoints = _fixture.CreateMany <Framework.CrossSectionPoint>().ToList();

            _mockCrossSectionPointMapper = Substitute.For <ICrossSectionPointMapper>();
            _mockCrossSectionPointMapper.MapPoints(Arg.Any <List <ICrossSectionPoint> >())
            .Returns(_crossSectionPoints);

            _crossSectionMapper = new CrossSectionMapper(_mockCrossSectionPointMapper);

            _crossSectionSurvey = new CrossSectionSurvey
            {
                Fields = TestData.TestHelpers.CreateExpectedCrossSectionFields()
            };
        }