コード例 #1
0
ファイル: DtoConversionTests.cs プロジェクト: BooTeK/Rainy
        public void ConvertFromDTOWithTags()
        {
            var dto_note = new DTONote ();
            dto_note.Tags = new string[] { "school", "shopping", "fun" };

            var tomboy_note = dto_note.ToTomboyNote ();

            foreach (string tag in dto_note.Tags) {
                Assert.Contains (tag, tomboy_note.Tags.Keys);
            }
        }
コード例 #2
0
ファイル: DtoConversionTests.cs プロジェクト: BooTeK/Rainy
        public void ConvertFromDTONoteToTomboyNote()
        {
            var dto_note = new DTONote ();
            dto_note.Title = "This is a sample note";
            dto_note.Text = "This is some sample text";

            dto_note.ChangeDate = DateTime.Now.ToString (Tomboy.Writer.DATE_TIME_FORMAT);
            dto_note.MetadataChangeDate = DateTime.Now.ToString (Tomboy.Writer.DATE_TIME_FORMAT);
            dto_note.CreateDate = DateTime.Now.ToString (Tomboy.Writer.DATE_TIME_FORMAT);

            var tomboy_note = dto_note.ToTomboyNote ();

            Assert.AreEqual (tomboy_note.Title, dto_note.Title);
            Assert.AreEqual (tomboy_note.Text, dto_note.Text);

            Assert.AreEqual (tomboy_note.ChangeDate, DateTime.Parse (dto_note.ChangeDate).ToUniversalTime ());
            Assert.AreEqual (tomboy_note.CreateDate, DateTime.Parse (dto_note.CreateDate).ToUniversalTime ());
            Assert.AreEqual (tomboy_note.MetadataChangeDate, DateTime.Parse (dto_note.MetadataChangeDate).ToUniversalTime ());

            var tag_intersection = dto_note.Tags.Intersect (tomboy_note.Tags.Keys);
            Assert.AreEqual (dto_note.Tags.Count (), tag_intersection.Count ());
        }