Beispiel #1
0
        public static AccidentStatisticDb ConvertFrom(this AccidentStatistic accidentStatistic)
        {
            var result = new AccidentStatisticDb
            {
                TflId     = accidentStatistic.Id,
                Borough   = accidentStatistic.Borough,
                Date      = accidentStatistic.Date,
                Latitude  = accidentStatistic.Latitude,
                Longitude = accidentStatistic.Longitude,
                Location  = accidentStatistic.Location
            };

            result.ConvertVehicles(accidentStatistic);
            result.ConvertCasualties(accidentStatistic);
            Enum.TryParse(accidentStatistic.Severity.ToString(), true, out Severity severity);
            result.Severity = severity;
            return(result);
        }
 public MappingExtensionsShould()
 {
     _autoFixture       = new Fixture();
     _accidentStatistic = CreateAccidentStatistic();
 }
Beispiel #3
0
 private static void ConvertCasualties(this AccidentStatisticDb accidentStatisticDb, AccidentStatistic tflAccidentStatistic)
 {
     foreach (var accidentStatisticCasualty in tflAccidentStatistic.Casualties)
     {
         accidentStatisticDb.Casualties.Add(accidentStatisticDb.ConvertFrom(accidentStatisticCasualty));
     }
 }
Beispiel #4
0
 private static void ConvertVehicles(this AccidentStatisticDb accidentStatisticDb, AccidentStatistic tflAccidentStatistic)
 {
     foreach (var accidentStatisticVehicle in tflAccidentStatistic.Vehicles)
     {
         var newVehicle = accidentStatisticDb.ConvertFrom(accidentStatisticVehicle);
         accidentStatisticDb.Vehicles.Add(newVehicle);
     }
 }