예제 #1
0
        public void GenerateContentSeparatorTest()
        {
            MinutesModel model    = new MinutesModel();
            string       expected = "*********************************************************\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateContentSeparator());
        }
예제 #2
0
        public void GenerateExportAgendaContentTest()
        {
            string       expected = "(1) agenda1\n\t[decided]agenda1->detail1 content\n\t\t[important]agenda1->detail2 content\n";
            MinutesModel model    = new MinutesModel();
            AgendaItem   agenda   = new AgendaItem(1);

            agenda.m_AgendaIndex = 1;
            agenda.m_Content     = "agenda1";
            agenda.m_DetailItems = new System.Collections.ObjectModel.ObservableCollection <DetailItem>();
            DetailItem detail1 = new DetailItem();

            detail1.m_ContentIndex       = 1;
            detail1.m_ContentIndentLevel = 1;
            detail1.m_Content            = "agenda1->detail1 content";
            detail1.m_ContentStateType   = ContentStateType.decided;
            agenda.m_DetailItems.Add(detail1);
            DetailItem detail2 = new DetailItem();

            detail2.m_ContentIndex       = 2;
            detail2.m_ContentIndentLevel = 2;
            detail2.m_Content            = "agenda1->detail2 content";
            detail2.m_ContentStateType   = ContentStateType.important;
            agenda.m_DetailItems.Add(detail2);

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportAgendaContent(agenda));
        }
예제 #3
0
        public void GenerateExportRoomContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_Room = "room1";
            string expected = "[Room]room1\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportRoomContent());
        }
예제 #4
0
        public void GenerateExportTitleContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_Title = "title";
            string expected = "[Title]title\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportTitleContent());
        }
예제 #5
0
        public void GenerateExportDayContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_Day = new DateTime(2017, 2, 1);
            string expected = "[Day]2017/02/01\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportDayContent());
        }
예제 #6
0
        public void GenerateExportTimeContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_StartTime = new DateTime(2000, 1, 2, 3, 4, 5);
            model.m_EndTime   = new DateTime(2001, 6, 7, 8, 9, 10);
            string expected = "[Time]03:04 ~ 08:09\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportTimeContent());
        }
예제 #7
0
        public void GenerateExportParticipantsContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_Participants = new System.Collections.ObjectModel.ObservableCollection <Participant> {
                new Participant("man1", 0), new Participant("man2", 1), new Participant("woman1", 2)
            };
            string expected = "[Participants]man1,man2,woman1\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportParticipantsContent());
        }
예제 #8
0
        public void GenerateExportWritersContentTest()
        {
            MinutesModel model = new MinutesModel();

            model.m_Writers = new System.Collections.ObjectModel.ObservableCollection <Writer> {
                new Writer("man1", 0), new Writer("woman1", 1)
            };
            string expected = "[Writers]man1,woman1\n";

            Assert.AreEqual(expected, model.AsDynamic().GenerateExportWritersContent());
        }
예제 #9
0
        public void GenerateExportDetailContentTest()
        {
            MinutesModel model = new MinutesModel();

            string     expected1 = "\t[decided]agenda1->detail1 content\n";
            DetailItem detail1   = new DetailItem();

            detail1.m_ContentIndex       = 1;
            detail1.m_ContentIndentLevel = 1;
            detail1.m_Content            = "agenda1->detail1 content";
            detail1.m_ContentStateType   = ContentStateType.decided;
            Assert.AreEqual(expected1, model.AsDynamic().GenerateExportDetailContent(detail1));

            string     expected2 = "\t\t[important]agenda1->detail2 content\n";
            DetailItem detail2   = new DetailItem();

            detail2.m_ContentIndex       = 2;
            detail2.m_ContentIndentLevel = 2;
            detail2.m_Content            = "agenda1->detail2 content";
            detail2.m_ContentStateType   = ContentStateType.important;
            Assert.AreEqual(expected2, model.AsDynamic().GenerateExportDetailContent(detail2));

            string     expected3 = "\t\t\t[issue]agenda1->detail3 content\n";
            DetailItem detail3   = new DetailItem();

            detail3.m_ContentIndex       = 3;
            detail3.m_ContentIndentLevel = 3;
            detail3.m_Content            = "agenda1->detail3 content";
            detail3.m_ContentStateType   = ContentStateType.issue;
            Assert.AreEqual(expected3, model.AsDynamic().GenerateExportDetailContent(detail3));

            string     expected4 = "\t\t\t・agenda1->detail4 content\n";
            DetailItem detail4   = new DetailItem();

            detail4.m_ContentIndex       = 4;
            detail4.m_ContentIndentLevel = 3;
            detail4.m_Content            = "agenda1->detail4 content";
            detail4.m_ContentStateType   = ContentStateType.none;
            Assert.AreEqual(expected4, model.AsDynamic().GenerateExportDetailContent(detail4));
        }
예제 #10
0
        public void ConvertToRealMinutesName()
        {
            MinutesModel model = new MinutesModel();

            model.m_Title     = "Title";
            model.m_Day       = new DateTime(2017, 3, 7);           //2017/03/07
            model.m_StartTime = new DateTime(2000, 1, 1, 12, 0, 0); //2000/01/01 12:00.00
            model.m_EndTime   = new DateTime(2000, 1, 1, 13, 0, 0); //2000/01/01 13:00.00
            model.m_Room      = "Room1";

            string convertTarget         = "%Title%_%Day%_%StartTime%-%EndTime%_%Room%";
            string convertedExpectedName = "Title_20170307_12:00-13:00_Room1";

            Assert.AreEqual(convertedExpectedName, model.AsDynamic().ConvertToRealMinutesName(convertTarget));
        }
예제 #11
0
        public void GenerateTextFileContentsTest()
        {
            MinutesModel model = new MinutesModel();

            //条件設定
            model.m_Title        = "title";
            model.m_Day          = new DateTime(2017, 2, 1);
            model.m_StartTime    = new DateTime(2000, 1, 2, 3, 4, 5);
            model.m_EndTime      = new DateTime(2001, 6, 7, 8, 9, 10);
            model.m_Room         = "room1";
            model.m_Participants = new System.Collections.ObjectModel.ObservableCollection <Participant> {
                new Participant("participant1", 0), new Participant("participant2", 1), new Participant("participant3", 2)
            };
            model.m_Writers = new System.Collections.ObjectModel.ObservableCollection <Writer> {
                new Writer("writer1", 0), new Writer("writer2", 1)
            };
            model.m_Agendas = new System.Collections.ObjectModel.ObservableCollection <AgendaItem>();
            AgendaItem agenda1 = new AgendaItem(1);

            agenda1.m_AgendaIndex = 1;
            agenda1.m_Content     = "agenda1 content";
            agenda1.m_DetailItems = new System.Collections.ObjectModel.ObservableCollection <DetailItem>();
            DetailItem detail1 = new DetailItem();

            detail1.m_ContentIndex       = 1;
            detail1.m_ContentIndentLevel = 1;
            detail1.m_Content            = "agenda1->detail1 content";
            detail1.m_ContentStateType   = ContentStateType.decided;
            agenda1.m_DetailItems.Add(detail1);
            DetailItem detail2 = new DetailItem();

            detail2.m_ContentIndex       = 2;
            detail2.m_ContentIndentLevel = 2;
            detail2.m_Content            = "agenda1->detail2 content";
            detail2.m_ContentStateType   = ContentStateType.important;
            agenda1.m_DetailItems.Add(detail2);
            DetailItem detail3 = new DetailItem();

            detail3.m_ContentIndex       = 3;
            detail3.m_ContentIndentLevel = 3;
            detail3.m_Content            = "agenda1->detail3 content";
            detail3.m_ContentStateType   = ContentStateType.issue;
            agenda1.m_DetailItems.Add(detail3);
            DetailItem detail4 = new DetailItem();

            detail4.m_ContentIndex       = 4;
            detail4.m_ContentIndentLevel = 3;
            detail4.m_Content            = "agenda1->detail4 content";
            detail4.m_ContentStateType   = ContentStateType.none;
            agenda1.m_DetailItems.Add(detail4);
            model.m_Agendas.Add(agenda1);

            //結果はこうなるはず
            string expected = "*********************************************************\n" +
                              "[Title]title\n" +
                              "[Day]2017/02/01\n" +
                              "[Time]03:04 ~ 08:09\n" +
                              "[Room]room1\n" +
                              "[Participants]participant1,participant2,participant3\n" +
                              "[Writers]writer1,writer2\n" +
                              "*********************************************************\n" +
                              "(1) agenda1 content\n" +
                              "\t[decided]agenda1->detail1 content\n" +
                              "\t\t[important]agenda1->detail2 content\n" +
                              "\t\t\t[issue]agenda1->detail3 content\n" +
                              "\t\t\t・agenda1->detail4 content\n";
            object        result  = "";
            PrivateObject pObj    = new PrivateObject(model);
            string        result2 = pObj.Invoke("GenerateTextFileContents", null) as string;

            Assert.AreEqual(expected, result2);                                         //これが普通の書き方
            Assert.AreEqual(expected, model.AsDynamic().GenerateTextFileContents());    //Chaining Assertionというライブラリでこんなことができる。すげー
            (model.AsDynamic().GenerateTextFileContents() as string).Is(expected);      //Chaining Assertionを使えばこんな風にも書ける。注意点はキャストが必ず必要なことらしい
        }