public void AddCrossSectionSurvey(FieldVisitInfo fieldVisit, CrossSectionSurvey crossSectionSurvey) { fieldVisit.CrossSectionSurveys.Add(crossSectionSurvey); ExtendVisitPeriod(fieldVisit, new[] { crossSectionSurvey.SurveyPeriod.Start, crossSectionSurvey.SurveyPeriod.End }); }
public void GetFieldValue_NullField_Throws() { var crossSection = new CrossSectionSurvey(); TestDelegate testDelegate = () => crossSection.GetFieldValue(null); Assert.That(testDelegate, Throws.Exception.TypeOf <ArgumentNullException>()); }
private FieldVisitInfo CreateFieldVisit(LocationInfo location, CrossSectionSurvey crossSectionSurvey) { var fieldVisit = new FieldVisitDetails(crossSectionSurvey.SurveyPeriod) { Party = crossSectionSurvey.Party }; return(_fieldDataResultsAppender.AddFieldVisit(location, fieldVisit)); }
public void GetFieldValue_FieldDoesNotExist_Throws() { var crossSection = new CrossSectionSurvey(); const string field = "SomeKey"; TestDelegate testDelegate = () => crossSection.GetFieldValue(field); Assert.That(testDelegate, Throws.Exception.TypeOf <CrossSectionCsvFormatException>().With.Message.Contains(field)); }
private ParseFileResult ProcessParsedFileContents(CrossSectionSurvey parsedFileContents) { var crossSectionSurvey = MapToCrossSectionSurvey(parsedFileContents); var locationIdentifier = GetLocationIdentifier(parsedFileContents); var fieldVisitInfo = _fieldVisitHandler.GetFieldVisit(locationIdentifier, crossSectionSurvey); _fieldDataResultsAppender.AddCrossSectionSurvey(fieldVisitInfo, crossSectionSurvey); return(ParseFileResult.SuccessfullyParsedAndDataValid()); }
public void GetFieldValue_FieldExists_ReturnsExpectedValue() { var crossSection = new CrossSectionSurvey(); const string field = "SomeKey"; const string data = "value"; crossSection.Fields.Add(field, data); var result = crossSection.GetFieldValue(field); Assert.That(result, Is.EqualTo(data)); }
private static void UpgradeCrossSectionSurvey(CrossSectionSurvey survey) { if (survey.CrossSectionPoints.Any(p => p.PointOrder != JsonConfig.LegacyPointOrder)) { return; } survey.CrossSectionPoints = survey .CrossSectionPoints .Select((point, i) => new CrossSectionPoint(1 + i, point.Distance, point.Elevation) { Comments = point.Comments, Depth = point.Depth }) .ToList(); }
private static void AssertCrossSectionMatchesExpected(CrossSectionSurvey result, IDictionary <string, string> expectedCrossSectionFields, List <CrossSectionPointV2> expectedPoints) { result.Fields.ShouldBeEquivalentTo(expectedCrossSectionFields); result.Points.Should().HaveCount(expectedPoints.Count); for (var i = 0; i < result.Points.Count; i++) { var actual = result.Points[i] as CrossSectionPointV2; var expected = expectedPoints[i]; Assert.That(actual, Is.Not.Null); actual.PointOrder.Should().Be(expected.PointOrder); actual.Distance.Should().Be(expected.Distance); actual.Elevation.Should().Be(expected.Elevation); actual.Comment.Should().Be(expected.Comment); } }
public void AddCrossSectionSurvey(FieldVisitInfo fieldVisit, CrossSectionSurvey crossSectionSurvey) { fieldVisit.CrossSectionSurveys.Add(crossSectionSurvey); }
private static string GetLocationIdentifier(CrossSectionSurvey crossSectionSurvey) { return(crossSectionSurvey.GetFieldValue(CrossSectionDataFields.Location)); }
private static FieldDataPluginFramework.DataModel.CrossSection.CrossSectionSurvey MapToCrossSectionSurvey(CrossSectionSurvey parsedFileContents) { var crossSectionMapper = new CrossSectionMapper(new CrossSectionPointMapper()); return(crossSectionMapper.MapCrossSection(parsedFileContents)); }
private void CreateCrossSectionSurvey() { CrossSectionSurvey = new CrossSectionSurvey(); }
public FieldVisitInfo GetFieldVisit(string locationIdentifier, CrossSectionSurvey crossSectionSurvey) { var location = _fieldDataResultsAppender.GetLocationByIdentifier(locationIdentifier); return(CreateFieldVisit(location, crossSectionSurvey)); }