public void Copy(Depth newDepth) { if (newDepth == null) { throw new ArgumentNullException("newDepth"); } if (newDepth.IsSideModified) { Side = newDepth.Side; } base.Copy(newDepth); }
private static LandDetails ExtractLandDetails(XElement document) { document.ShouldNotBe(null); var landDetailsElement = document.Element("landDetails"); if (landDetailsElement == null) { return null; } var details = new LandDetails { Area = landDetailsElement.UnitOfMeasureOrDefault("area", "unit"), Frontage = landDetailsElement.UnitOfMeasureOrDefault("frontage", "unit"), CrossOver = landDetailsElement.ValueOrDefault("crossOver", "value") }; var depthElements = landDetailsElement.Elements("depth").ToArray(); if (depthElements.Any()) { foreach (var depthElement in depthElements) { var depthValue = depthElement.DecimalValueOrDefault(); var depthType = depthElement.AttributeValueOrDefault("unit"); var depthSide = depthElement.AttributeValueOrDefault("side"); if (depthValue > 0) { var depth = new Depth { Value = depthValue, Type = string.IsNullOrWhiteSpace(depthType) ? "Total" : depthType, Side = depthSide }; if (details.Depths == null) { details.Depths = new List<Depth>(); } details.Depths.Add(depth); } } } return details; }