Пример #1
0
        private Meeting GetOriginalMeetingfromJson()
        {
            var raceData = _jsonService.ParseOriginalSample();

            var meeting = _jsonService.Transform(raceData);

            return(meeting);
        }
Пример #2
0
        [Fact] //(Skip = "Because time consuming")
        public void CanParseJsonSampleData()
        {
            var raceData = _jsonService.ParseOriginalSample();

            raceData.meeting.name += "HuHu";
            var meeting = _jsonService.Transform(raceData);

            Assert.Equal("CanterburryHuHu", meeting.Name);
            Assert.Equal(3, meeting.Races.Count);
        }
Пример #3
0
        public void Run()
        {
            _logger.LogInformation($"This is a console application for {_config.Title}");

            _logger.LogInformation("Begin parsing jsonFile");

            var raceData = _jsonService.ParseOriginalSample();

            System.Console.WriteLine(raceData);

            _logger.LogInformation("End parsing");

            _logger.LogInformation("Begin transforming to domain entity");

            var meeting = _jsonService.Transform(raceData);

            _logger.LogInformation("End transforming");

            using (var context = new MeetingContext(_options))
            {
                context.Database.EnsureCreated();
                var service = new MeetingService(context, _strategy);
                service.SaveMeeting(meeting);
                context.SaveChanges();
            }

            var meeting2 = _jsonService.Transform(raceData);

            using (var context = new MeetingContext(_options))
            {
                var service = new MeetingService(context, _strategy);
                service.SaveMeeting(meeting2);
                context.SaveChanges();
            }

            System.Console.ReadKey();
        }