コード例 #1
0
ファイル: ArticleTest.cs プロジェクト: rocketeerbkw/DNA
        public void GetBookmarkCount_WithSingleRow_ReturnsSingleBookmark()
        {
            Article target = new Article();
            MockRepository mocks = new MockRepository();
            IDnaDataReader reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("BookmarkCount")).Return(1);

            IDnaDataReaderCreator creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("GetBookmarkCount")).Return(reader);
            mocks.ReplayAll();

            target.GetBookmarkCount(creator);
            Assert.AreEqual(target.BookmarkCount, 1);
        }