コード例 #1
0
ファイル: CreateTests.cs プロジェクト: eLVampa/PeerAssasment
        public void Test()
        {
            var discussion = new Discussion
                {
                    Id = Guid.NewGuid(),
                    Title = "Text!"
                };

            discussionsRepository.Create(discussion);

            var actual = discussionsRepository.Read(discussion.Id);
            Assert.AreEqual(discussion.Title, actual.Title);
        }
コード例 #2
0
        private bool TryConvertDiscussionModelToDiscussion(DiscussionModel discussionModel, out Discussion discussion)
        {
            discussion = null;

            Guid id;
            if (!Guid.TryParse(discussionModel.Id, out id))
                return false;
            discussion = new Discussion
                {
                    Id = id,
                    Title = discussionModel.Title,
                    State = int.Parse(discussionModel.State)
                };
            return true;
        }