예제 #1
0
        public ViewMeeting_Dto GenerateFake()
        {
            // A "talk" is a speaker and what he/she said.
            var talk = new Faker <ViewMeetingTalk_Dto>()
                       .RuleFor(x => x.SpeakerId, f => GenerateSpeaker())
                       .RuleFor(x => x.Text, f => fakeData.Text(f, 1));

            // A topicDiscussion is a series of talks on a single topic.
            var topicDiscussion = new Faker <ViewMeetingTopicDiscussion_Dto>()
                                  .RuleFor(x => x.TopicId, f => GenerateTopic())
                                  .RuleFor(x => x.Talks, f => Generate(talk, 2));

            // A section is a series of topicDiscussions.
            var section = new Faker <ViewMeetingSection_Dto>()
                          .RuleFor(x => x.Name, f => GenerateSection())
                          .RuleFor(x => x.TopicDiscussions, f => Generate(topicDiscussion, 2));

            // A meetingViewDto is a series of sections
            var dto = new Faker <ViewMeeting_Dto>()
                      .RuleFor(x => x.MeetingId, f => MeetingId)
                      .RuleFor(x => x.GovbodyName, f => "City Council")
                      .RuleFor(x => x.LocationName, f => "United States - Texas - Potter County - Amarillo")
                      .RuleFor(x => x.Date, f => meetingDate)
                      .RuleFor(x => x.Sections, f => Generate(section, 2));

            ViewMeeting_Dto meetingViewDto = dto.Generate(1)[0];

            meetingViewDto.Topics   = Topics;
            meetingViewDto.Speakers = Speakers;

            return(meetingViewDto);
        }
        public ViewMeeting_Dto Get(int meetingId)
        {
            string          transcript  = Meetings.Get(meetingId);
            ViewMeeting_Dto viewMeeting = JsonConvert.DeserializeObject <ViewMeeting_Dto>(transcript);

            return(viewMeeting);
        }
예제 #3
0
        public bool Put(int meetingId, ViewMeeting_Dto meetingDto)
        {
            string stringValue = JsonConvert.SerializeObject(meetingDto, Formatting.Indented);
            bool   result      = Meetings.Put(meetingId, stringValue);

            return(result);
        }
예제 #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            string text;

            //FakeMeeting fm = new FakeMeeting();
            //Meeting meeting = fm.GenerateFake();
            //text = Newtonsoft.Json.JsonConvert.SerializeObject(meeting, Newtonsoft.Json.Formatting.Indented);
            //File.WriteAllText(@"c:\tmp\fakemeeting.json", text);

            FakeTranscriptViewDto ft  = new FakeTranscriptViewDto();
            ViewMeeting_Dto       tvm = ft.GenerateFake();

            text = Newtonsoft.Json.JsonConvert.SerializeObject(tvm, Newtonsoft.Json.Formatting.Indented);
            File.WriteAllText(@"c:\tmp\faketvm.json", text);
        }