当前位置: 首页>>代码示例>>C#>>正文


C# IDnaDataReader.Stub方法代码示例

本文整理汇总了C#中IDnaDataReader.Stub方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.Stub方法的具体用法?C# IDnaDataReader.Stub怎么用?C# IDnaDataReader.Stub使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDnaDataReader的用法示例。


在下文中一共展示了IDnaDataReader.Stub方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExModerationEvent_BuildExModerationEvents_ExpectUriToBeCorrect

        public void ExModerationEvent_BuildExModerationEvents_ExpectUriToBeCorrect()
        {
            _mockreader = MockRepository.GenerateStub<IDnaDataReader>();

            _mockreader.Stub(c => c.GetInt32NullAsZero("modid")).Return(0);
            _mockreader.Stub(c => c.GetString("notes")).Return(null);
            _mockreader.Stub(c => c.GetString("uri")).Return(_uri);
            _mockreader.Stub(c => c.GetDateTime("datecompleted")).Return(DateTime.MinValue);
            _mockreader.Stub(c => c.GetInt32NullAsZero("status")).Return(0);
            _mockreader.Stub(c => c.GetString("callbackuri")).Return(null);
            _mockreader.Stub(c => c.GetString("reasontype")).Return(null);
            _mockreader.Stub(c => c.GetString("reasontext")).Return(null);

            ExModerationEvent activity = new ExModerationEvent();
            activity = ExModerationEvent.CreateExModerationEvent(_mockreader);

            Assert.AreEqual(_uri, activity.Uri);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:ExModerationProcessorTests.cs

示例2: SetupArticleLocationMocks

        private void SetupArticleLocationMocks(out MockRepository mocks, out IDnaDataReaderCreator readerCreator, out IDnaDataReader reader, int rowsToReturn)
        {
            InitialiseMocks(out mocks, out readerCreator, out reader);

            if (rowsToReturn == 0)
            {
                reader.Stub(x => x.HasRows).Return(false);
                reader.Stub(x => x.Read()).Return(false);

            }
            else
            {
                reader.Stub(x => x.HasRows).Return(true);
                reader.Stub(x => x.Read()).Return(true);

                AddArticleLocationTestDatabaseRows(reader);
            }

            readerCreator.Stub(x => x.CreateDnaDataReader("GetGuideEntryLocation")).Return(reader);

            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:22,代码来源:ArticleLocationTest.cs

示例3: AddReviewSubmissionsListTestDatabaseRows

 private void AddReviewSubmissionsListTestDatabaseRows(IDnaDataReader reader)
 {
     reader.Stub(x => x.GetInt32NullAsZero("postid")).Return(1);
     reader.Stub(x => x.GetInt32NullAsZero("threadid")).Return(12345);
     reader.Stub(x => x.GetInt32NullAsZero("forumid")).Return(24088151);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:6,代码来源:ReviewSubmissionTest.cs

示例4: AddMonthSummaryTestDatabaseRows

 private void AddMonthSummaryTestDatabaseRows(IDnaDataReader reader)
 {
     reader.Stub(x => x.GetStringNullAsEmpty("Subject")).Return("Test Subject").Repeat.Twice();
     reader.Stub(x => x.GetInt32NullAsZero("EntryID")).Return(2408815).Repeat.Twice();
     reader.Stub(x => x.GetInt32NullAsZero("h2g2ID")).Return(24088151).Repeat.Twice();
     reader.Stub(x => x.GetInt32NullAsZero("type")).Return(1).Repeat.Twice();
     reader.Stub(x => x.GetDateTime("datecreated")).Return(DateTime.Now).Repeat.Twice();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:8,代码来源:MonthSummaryTest.cs

示例5: SubmittableTestSetup

        private static void SubmittableTestSetup(out MockRepository mocks, out IDnaDataReader reader, out IDnaDataReaderCreator creator)
        {
            mocks = new MockRepository();
            reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);

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

            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:ArticleInfoSubmittableTest.cs

示例6: AddArticleListUserDatabaseRows

        private void AddArticleListUserDatabaseRows(IDnaDataReader reader, string suffix)
        {
            reader.Stub(x => x.Exists(suffix + "userID")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero(suffix + "userID")).Return(1090497224).Repeat.Once();

            reader.Stub(x => x.Exists(suffix + "userid")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero(suffix + "userid")).Return(1090497224).Repeat.Once();

            reader.Stub(x => x.Exists(suffix + "IdentityUserID")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "IdentityUserID")).Return("608234").Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "LoginName")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "LoginName")).Return("Damnyoureyes").Repeat.Once();

            reader.Stub(x => x.Exists(suffix + "Name")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "Name")).Return("name").Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "Area")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "Area")).Return("Editor Area").Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "Status")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero(suffix + "Status")).Return(2).Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "TaxonomyNode")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero(suffix + "TaxonomyNode")).Return(3).Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "Journal")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero(suffix + "Journal")).Return(4).Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "Active")).Return(true);
            reader.Stub(x => x.GetBoolean(suffix + "Active")).Return(true).Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "SiteSuffix")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "SiteSuffix")).Return("suffix").Repeat.Once();
            reader.Stub(x => x.Exists(suffix + "Title")).Return(true);
            reader.Stub(x => x.GetStringNullAsEmpty(suffix + "Title")).Return("title").Repeat.Once();

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:31,代码来源:ArticleListTest.cs

示例7: SetupScoutRecommendationsMocks

        private void SetupScoutRecommendationsMocks(out MockRepository mocks, out IDnaDataReaderCreator readerCreator, out IDnaDataReader reader, out ISite site, int rowsToReturn)
        {
            InitialiseMocks(out mocks, out readerCreator, out reader);
            
            site = mocks.DynamicMock<ISite>();
            site.Stub(x => x.SiteID).Return(1);
            site.Stub(x => x.ModClassID).Return(1);

            if (rowsToReturn > 0)
            {
                reader.Stub(x => x.HasRows).Return(true);
                reader.Stub(x => x.Read()).Return(true).Repeat.Times(rowsToReturn);
            }
            else
            {
                reader.Stub(x => x.HasRows).Return(false);
                reader.Stub(x => x.Read()).Return(false);
            }
            AddSetupScoutRecommendsResponseDatabaseRows(reader);

            readerCreator.Stub(x => x.CreateDnaDataReader("FetchUndecidedRecommendations")).Return(reader);

            ProfanityFilterTests.InitialiseProfanities();

            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:26,代码来源:ScoutRecommendationsTest.cs

示例8: CreateThreadFromDatabaseTestSetup

        private static void CreateThreadFromDatabaseTestSetup(out MockRepository mocks, out int siteId, out int forumId, out int threadId, out int itemsPerPage, out int startIndex, out int postId, out int entryId, out bool orderByDatePostedDesc, out IDnaDataReader reader, out IDnaDataReaderCreator creator)
        {
            mocks = new MockRepository();
            siteId = 1;
            forumId = 1;
            threadId = 1;
            itemsPerPage = 10;
            startIndex = 0;
            postId = 0;
            entryId = 22;
            orderByDatePostedDesc = false;

            reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true).Repeat.Times(itemsPerPage + 2);
            reader.Stub(x => x.GetInt32NullAsZero("EntryID")).Return(entryId);
            reader.Stub(x => x.GetInt32NullAsZero("Total")).Return(itemsPerPage * 2 + 1);//more should = 1

            creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("threadlistposts2")).Return(reader);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:22,代码来源:ThreadTest.cs

示例9: AddRecommendationTestDatabaseRows

        private void AddRecommendationTestDatabaseRows(IDnaDataReader reader)
        {
            reader.Stub(x => x.GetStringNullAsEmpty("Subject")).Return("Test Subject").Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("OriginalEntryID")).Return(2408805).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("Originalh2g2ID")).Return(24088052).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("EntryID")).Return(2408815).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("h2g2ID")).Return(24088151).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("GuideStatus")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("AcceptedStatus")).Return(1).Repeat.Twice();

            reader.Stub(x => x.GetDateTime("DateAllocated")).Return(DateTime.Now).Repeat.Twice();
            reader.Stub(x => x.GetDateTime("DateReturned")).Return(DateTime.Now).Repeat.Twice();

            reader.Stub(x => x.Exists("SubEditorID")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorName")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorFirstNames")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorLastName")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorArea")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorStatus")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorTaxomyNode")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorJournal")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorActive")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorSiteSuffix")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("SubEditorTitle")).Return(true).Repeat.Twice();

            reader.Stub(x => x.Exists("ScoutID")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutName")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutFirstNames")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutLastName")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutArea")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutStatus")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutTaxomyNode")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutJournal")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutActive")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutSiteSuffix")).Return(true).Repeat.Twice();
            reader.Stub(x => x.Exists("ScoutTitle")).Return(true).Repeat.Twice();


            reader.Stub(x => x.GetInt32NullAsZero("SubEditorID")).Return(2408805).Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("SubEditorName")).Return("FredSmith").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("SubEditorFirstNames")).Return("Fred").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("SubEditorLastName")).Return("Smith").Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("SubEditorArea")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("SubEditorStatus")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("SubEditorTaxomyNode")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("SubEditorJournal")).Return(123456).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("SubEditorActive")).Return(1).Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("SubEditorSiteSuffix")).Return("SiteSuffix").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("SubEditorTitle")).Return("Title").Repeat.Twice();

            reader.Stub(x => x.GetInt32NullAsZero("ScoutID")).Return(1090558353).Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("ScoutName")).Return("Scout").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("ScoutFirstNames")).Return("FirstScout").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("ScoutLastName")).Return("LastScout").Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("ScoutArea")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("ScoutStatus")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("ScoutTaxomyNode")).Return(4).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("ScoutJournal")).Return(123456).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("ScoutActive")).Return(1).Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("ScoutSiteSuffix")).Return("SiteSuffix").Repeat.Twice();
            reader.Stub(x => x.GetStringNullAsEmpty("ScoutTitle")).Return("Title").Repeat.Twice();

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:63,代码来源:RecommendationsTest.cs

示例10: SetupRecommendationsMocks

        private void SetupRecommendationsMocks(out MockRepository mocks, out IDnaDataReaderCreator readerCreator, out IDnaDataReader reader)
        {
            mocks = new MockRepository();
            readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();

            // mock the search response
            reader = mocks.DynamicMock<IDnaDataReader>();

            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true).Repeat.Times(2);

            AddRecommendationTestDatabaseRows(reader);

            readerCreator.Stub(x => x.CreateDnaDataReader("getacceptedentries")).Return(reader);

            mocks.ReplayAll();

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:RecommendationsTest.cs

示例11: AddArticleSubscriptionsListArticlesDatabaseRows

        private void AddArticleSubscriptionsListArticlesDatabaseRows(IDnaDataReader reader)
        {
            reader.Stub(x => x.HasRows).Return(true);

            reader.Stub(x => x.NextResult()).Return(true);

            reader.Stub(x => x.Read()).Return(true).Repeat.Times(2);
            reader.Stub(x => x.GetInt32("IsMainArticle")).Return(1);
            reader.Stub(x => x.GetInt32("EntryID")).Return(73322156);
            reader.Stub(x => x.GetTinyIntAsInt("style")).Return(1);
            reader.Stub(x => x.GetInt32("PreProcessed")).Return(10);
            reader.Stub(x => x.GetString("text")).Return("<GUIDE><BODY>this is an<BR /> article</BODY></GUIDE>");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:ArticleSubscriptionsListTest.cs

示例12: AddArticleSubscriptionsListArticlePageAuthorsDatabaseRows

 private void AddArticleSubscriptionsListArticlePageAuthorsDatabaseRows(IDnaDataReader reader)
 {
     reader.Stub(x => x.HasRows).Return(true);
     reader.Stub(x => x.Read()).Return(true).Repeat.Once();
     //PageAuthor
     reader.Stub(x => x.Exists("UserID")).Return(true);
     reader.Stub(x => x.GetInt32("UserID")).Return(1090497224).Repeat.Once();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:8,代码来源:ArticleSubscriptionsListTest.cs

示例13: AddForumSourceTestDatabaseRows

        private void AddForumSourceTestDatabaseRows(IDnaDataReader reader)
        {
            reader.Stub(x => x.GetStringNullAsEmpty("Subject")).Return("Test Subject").Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("Type")).Return(1).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("AlertInstantly")).Return(0).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("EntryID")).Return(2408815).Repeat.Twice();
            reader.Stub(x => x.GetInt32NullAsZero("h2g2ID")).Return(24088151).Repeat.Twice();
            reader.Stub(x => x.GetInt32("EntryID")).Return(2408815).Repeat.Twice();
            reader.Stub(x => x.GetInt32("h2g2ID")).Return(24088151).Repeat.Twice();
            reader.Stub(x => x.GetInt32("ForumID")).Return(1).Repeat.Twice();

            reader.Stub(x => x.GetDateTime("datecreated")).Return(DateTime.Now).Repeat.Twice();

            reader.Stub(x => x.GetInt32("IsMainArticle")).Return(1);
            reader.Stub(x => x.GetInt32("Status")).Return(1);
            reader.Stub(x => x.GetTinyIntAsInt("style")).Return(1);
            reader.Stub(x => x.GetString("text")).Return("<GUIDE><BODY>this is an article</BODY></GUIDE>");

            reader.Stub(x => x.GetByteNullAsZero("ModerationStatus")).Return(3);
            reader.Stub(x => x.GetDateTime("DateCreated")).Return(DateTime.Now);
            reader.Stub(x => x.GetDateTime("LastUpdated")).Return(DateTime.Now);
            reader.Stub(x => x.GetInt32("PreProcessed")).Return(0);
            reader.Stub(x => x.GetInt32("SiteID")).Return(1);
            reader.Stub(x => x.GetTinyIntAsInt("Submittable")).Return(1);

            reader.Stub(x => x.GetByteNullAsZero("ModerationStatus")).Return(3);

        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:28,代码来源:ForumSourceTest.cs

示例14: SetupForumSourceMocks

        private void SetupForumSourceMocks(out MockRepository mocks, out ICacheManager cache, out IDnaDataReaderCreator readerCreator, out IDnaDataReader reader, int rowsToReturn)
        {
            InitialiseMocks(out mocks, out cache, out readerCreator, out reader);

            if (rowsToReturn > 0)
            {
                reader.Stub(x => x.HasRows).Return(true);
                reader.Stub(x => x.Read()).Return(true).Repeat.Times(rowsToReturn);
            }
            else
            {
                reader.Stub(x => x.HasRows).Return(false);
                reader.Stub(x => x.Read()).Return(false);
            }
            AddForumSourceTestDatabaseRows(reader);

            readerCreator.Stub(x => x.CreateDnaDataReader("getforumsource")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getarticlecomponents2")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getauthorsfromh2g2id")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getrelatedarticles")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getrelatedclubs")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getarticlecrumbtrail")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("GetBookmarkCount")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getforumstyle")).Return(reader);           

            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:27,代码来源:ForumSourceTest.cs

示例15: AddArticleLocationTestDatabaseRows

 private void AddArticleLocationTestDatabaseRows(IDnaDataReader reader)
 {
     //Add in locations
     reader.Stub(x => x.GetStringNullAsEmpty("description")).Return("Test Location 1").Repeat.Once();
     reader.Stub(x => x.GetStringNullAsEmpty("title")).Return("Test Location 1").Repeat.Once();
     reader.Stub(x => x.GetInt32NullAsZero("locationid")).Return(1).Repeat.Once();
     reader.Stub(x => x.GetInt32NullAsZero("ownerid")).Return(1090497224).Repeat.Once();
     reader.Stub(x => x.GetInt32NullAsZero("siteid")).Return(1).Repeat.Once();
     reader.Stub(x => x.GetDateTime("CreatedDate")).Return(DateTime.Now).Repeat.Once();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:10,代码来源:ArticleLocationTest.cs


注:本文中的IDnaDataReader.Stub方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。