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


C# IDnaDataReaderCreator.Stub方法代码示例

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


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

示例1: CreateMockedDataBaseObjects

 /// <summary>
 /// Creates a mocked datareader and loads it with row data ready to replay
 /// </summary>
 /// <param name="mocks">The mock repository object that all the tests are running with</param>
 /// <param name="procedureName">The name of the procedure you want to call</param>
 /// <param name="creator">The new DataReaderCreator object</param>
 /// <param name="reader">The new DataReader object</param>
 /// <param name="testRowData">A list of test row data to load the reader with</param>
 static public void CreateMockedDataBaseObjects(MockRepository mocks, string procedureName, out IDnaDataReaderCreator creator, out IDnaDataReader reader, List<TestDatabaseRow> testRowData)
 {
     reader = CreateMockedIDnaDataReader(mocks, testRowData);
     creator = mocks.DynamicMock<IDnaDataReaderCreator>();
     creator.Stub(x => x.CreateDnaDataReader(procedureName)).Return(reader);
     mocks.ReplayAll();
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:15,代码来源:DataReaderFactory.cs

示例2: 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

示例3: SetupReviewSubmissionMocks

        private void SetupReviewSubmissionMocks(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);
            }
            AddReviewSubmissionsListTestDatabaseRows(reader);

            readerCreator.Stub(x => x.CreateDnaDataReader("addarticletoreviewforummembers")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("ForceUpdateEntry")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("fetchpersonalspaceforum")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("fetchreviewforumdetails")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("posttoforum")).Return(reader);

            ProfanityFilterTests.InitialiseProfanities();

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

示例4: SetupCallingUserSenario

        private void SetupCallingUserSenario(int siteID, string dnaUserName, string siteSuffix, bool isKidsSite, bool useIdV4, string useUDNG, out ICacheManager mockedCacheManager, out IDnaDiagnostics mockedDiagnostics, out ISiteList mockedSiteList, out IDnaDataReaderCreator mockedCreator)
        {
            mockedCacheManager = _mocks.DynamicMock<ICacheManager>();
            mockedDiagnostics = _mocks.DynamicMock<IDnaDiagnostics>();

            mockedSiteList = _mocks.DynamicMock<ISiteList>();
            mockedSiteList.Stub(x => x.GetSiteOptionValueBool(siteID, "General", "IsKidsSite")).Return(isKidsSite);
            mockedSiteList.Stub(x => x.GetSiteOptionValueBool(siteID, "CommentForum", "UseIDv4")).Return(useIdV4);
            mockedSiteList.Stub(x => x.GetSiteOptionValueString(siteID, "User", "AutoGeneratedNames")).Return(useUDNG);

            mockedCreator = _mocks.DynamicMock<IDnaDataReaderCreator>();
            var mockedReader = _mocks.DynamicMock<IDnaDataReader>();
            var mockedUserReader = _mocks.DynamicMock<IDnaDataReader>();
            var mockedProfileReader = _mocks.DynamicMock<IDnaDataReader>();

            var mockedUpdateReader = _mocks.DynamicMock<IDnaDataReader>();
            mockedCreator.Stub(x => x.CreateDnaDataReader("updateuser2")).Return(mockedUpdateReader);
            mockedUserReader.Stub(x => x.GetInt32("userid")).Return(TestUserAccounts.GetNormalUserAccount.UserID);
            mockedUserReader.Stub(x => x.GetString("username")).Return(dnaUserName);
            mockedUserReader.Stub(x => x.GetStringNullAsEmpty("SiteSuffix")).Return(siteSuffix);
            mockedUserReader.Stub(x => x.Read()).Return(true);
            mockedUserReader.Stub(x => x.HasRows).Return(true);

            mockedCreator.Stub(x => x.CreateDnaDataReader("getbannedemails")).Return(mockedReader);
            mockedCreator.Stub(x => x.CreateDnaDataReader("createnewuserfromidentityid")).Return(mockedUserReader);
            mockedCreator.Stub(x => x.CreateDnaDataReader("synchroniseuserwithprofile")).Return(mockedProfileReader);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:27,代码来源:UserTests.cs

示例5: HasGroupAlertOnItemTestSetup

        private static void HasGroupAlertOnItemTestSetup(int groupIdExpected, 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);
            reader.Stub(x => x.GetInt32NullAsZero("GroupID")).Return(groupIdExpected);

            //test with Thread flag
            creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("getthreadgroupalertid")).Return(reader);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:13,代码来源:EmailAlertGroupTest.cs

示例6: 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

示例7: 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

示例8: AddMockedDataReader

 static public void AddMockedDataReader(MockRepository mocks, string procedureName, IDnaDataReaderCreator creator, out IDnaDataReader reader, List<TestDatabaseRow> testRowData)
 {
     reader = CreateMockedIDnaDataReader(mocks, testRowData);
     creator.Stub(x => x.CreateDnaDataReader(procedureName)).Return(reader);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:5,代码来源:DataReaderFactory.cs

示例9: StubDatabaseCall

        private static void StubDatabaseCall(IDnaDataReaderCreator readerCreator, IDnaDataReader reader, int totalActiveForums, DateTime closeDate, int count, DateTime lastRatedDate, int siteId, string urlName, string title, int totalPosts, string url, int upRatings, int downRatings)
        {
            reader.Stub(x => x.HasRows).Return(totalActiveForums > 0);

            if (totalActiveForums > 0)
            {
                reader.Stub(x => x.Read()).Return(true).Repeat.Once();
                reader.Stub(x => x.GetDateTime("ForumCloseDate")).Return(closeDate);
                reader.Stub(x => x.GetInt32("count")).Return(count);
                reader.Stub(x => x.GetDateTime("LastRatedDate")).Return(lastRatedDate);
                reader.Stub(x => x.GetInt32("siteid")).Return(siteId);
                reader.Stub(x => x.GetString("urlname")).Return(urlName);
                reader.Stub(x => x.GetString("title")).Return(title);
                reader.Stub(x => x.GetInt32("totalPosts")).Return(totalPosts);
                reader.Stub(x => x.GetString("url")).Return(url);
                reader.Stub(x => x.GetInt32("up")).Return(upRatings);
                reader.Stub(x => x.GetInt32("down")).Return(downRatings);
            }
            else
            {
                reader.Stub(x => x.Read()).Return(false);
            }

            readerCreator.Stub(x => x.CreateDnaDataReader("getcommentforumsactivity_ratings")).Return(reader);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:25,代码来源:CommentForumRatingActivityTests.cs

示例10: SetupBlockUnblockUserMocks

        private void SetupBlockUnblockUserMocks(out MockRepository mocks, 
                                        out ICacheManager cache, 
                                        out IDnaDataReaderCreator readerCreator, 
                                        out ICallingUser viewingUser, 
                                        out ISite site, 
                                        out IDnaDataReader reader, 
                                        out IDnaDataReader reader2,
                                        int viewingUserId)
        {
            mocks = new MockRepository();
            cache = mocks.DynamicMock<ICacheManager>();
            readerCreator = mocks.DynamicMock<IDnaDataReaderCreator>();
            site = mocks.DynamicMock<ISite>();
            viewingUser = mocks.DynamicMock<ICallingUser>();

            // mock the response
            viewingUser.Stub(x => x.UserID).Return(viewingUserId);
            viewingUser.Stub(x => x.IsUserA(BBC.Dna.Users.UserTypes.Editor)).Return(false);
            viewingUser.Stub(x => x.IsUserA(BBC.Dna.Users.UserTypes.SuperUser)).Return(false);

            reader = mocks.DynamicMock<IDnaDataReader>();
            reader2 = mocks.DynamicMock<IDnaDataReader>();

            AddBlockedUserSubscriptionsListUserDatabaseRows(reader, "");

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

            reader2.Stub(x => x.HasRows).Return(true);
            reader2.Stub(x => x.Read()).Return(true);

            readerCreator.Stub(x => x.CreateDnaDataReader("getdnauseridfromidentityusername")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("blockusersubscription")).Return(reader2);
            readerCreator.Stub(x => x.CreateDnaDataReader("unblockusersubscription")).Return(reader2);

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

示例11: SetupBlockedUserSubscriptionsListMocks

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

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

                //Return the user but no rows
                reader2.Stub(x => x.HasRows).Return(true);
                reader2.Stub(x => x.Read()).Return(true).Repeat.Once();
                reader2.Stub(x => x.Read()).Return(false).Repeat.Once();

                reader2.Stub(x => x.NextResult()).Return(false);

                AddBlockedUserSubscriptionsListUserDatabaseRows(reader, "");
                AddBlockedUserSubscriptionsListUserDatabaseRows(reader2, "Blocker");
                reader.Stub(x => x.GetBoolean("BlockerAcceptSubscriptions")).Return(true).Repeat.Once();

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

                reader2.Stub(x => x.HasRows).Return(true);
                reader2.Stub(x => x.Read()).Return(true);

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

                AddBlockedUserSubscriptionsListUserDatabaseRows(reader, "");

                AddBlockedUserSubscriptionsListUserDatabaseRows(reader2, "Blocker");
                AddBlockedUserSubscriptionsListUserDatabaseRows(reader2, "");
                AddBlockedUserSubscriptionsListUserDatabaseRows(reader2, "");

            }

            readerCreator.Stub(x => x.CreateDnaDataReader("getdnauseridfromidentityusername")).Return(reader);
            readerCreator.Stub(x => x.CreateDnaDataReader("getblockedusersubscriptions")).Return(reader2);

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

示例12: UpdatePermissionsForViewingUserTestSetup

        private static void UpdatePermissionsForViewingUserTestSetup(out MockRepository mocks, out IDnaDataReader reader, out IDnaDataReaderCreator creator, out IUser viewingIUser)
        {
            mocks = new MockRepository();
            reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("CanRead")).Return(0);
            reader.Stub(x => x.GetInt32NullAsZero("CanWrite")).Return(0);
            reader.Stub(x => x.GetInt32NullAsZero("CanChangePermissions")).Return(0);
            reader.Stub(x => x.GetInt32NullAsZero("DefaultCanRead")).Return(0);
            reader.Stub(x => x.GetInt32NullAsZero("DefaultCanWrite")).Return(0);
            reader.Stub(x => x.GetInt32NullAsZero("DefaultCanChangePermissions")).Return(0);

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

            viewingIUser = mocks.DynamicMock<IUser>();
            viewingIUser.Stub(x => x.UserLoggedIn).Return(true);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:20,代码来源:ArticleTest.cs

示例13: CreateJournalTestSetup

        private static void CreateJournalTestSetup(out int userId, out string identityUserName, out int forumId, out int threadId,
                                                           out int itemsPerPage, out int startIndex,
                                                           out ThreadOrder threadOrder, out bool overFlow,
                                                           out IDnaDataReaderCreator creator,
                                                           out ISiteList siteList, out int siteId)
        {
            var mocks = new MockRepository();
            siteId = 1;
            userId = 6;
            identityUserName = "Damnyoureyes";
            forumId = 7;
            threadId = 0;
            itemsPerPage = 10;
            startIndex = 0;
            threadOrder = ThreadOrder.LatestPost;
            overFlow = true;

            var reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("Journal")).Return(forumId);
            reader.Stub(x => x.GetInt32NullAsZero("ThreadID")).Return(threadId);
            reader.Stub(x => x.GetInt32NullAsZero("ThreadCount")).Return(itemsPerPage + 1);
            reader.Stub(x => x.GetInt32NullAsZero("SiteID")).Return(siteId);
            reader.Stub(x => x.DoesFieldExist("ForumPostCount")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("ForumPostCount")).Return(itemsPerPage + 1);
            reader.Stub(x => x.GetDateTime("ThreadLastUpdated")).Return(DateTime.MinValue);
            reader.Stub(x => x.GetDateTime("ForumLastUpdated")).Return(DateTime.MinValue);



            creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("finduserfromidentityusername")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("finduserfromid")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("forumgetthreadlist")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("GetForumSiteID")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("cachegetforumlastupdate")).Return(reader);

            var site = mocks.DynamicMock<ISite>();
            site.Stub(x => x.SiteID).Return(siteId);

            siteList = mocks.DynamicMock<ISiteList>();
            siteList.Stub(x => x.GetSite(1)).Return(site);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:45,代码来源:ForumThreadsTest.cs

示例14: CreateForumThreadsFromDatabaseTestSetup

        private static void CreateForumThreadsFromDatabaseTestSetup(out int forumId, out int threadId,
                                                                   out int itemsPerPage, out int startIndex,
                                                                   out ThreadOrder threadOrder, out bool overFlow,
                                                                   out IDnaDataReaderCreator creator,
                                                                   out ISiteList siteList, out int siteId)
        {
            var mocks = new MockRepository();
            siteId = 1;
            forumId = 1;
            threadId = 0;
            itemsPerPage = 10;
            startIndex = 0;
            threadOrder = ThreadOrder.LatestPost;
            overFlow = true;

            var reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("ThreadID")).Return(threadId);
            reader.Stub(x => x.GetInt32NullAsZero("ThreadCount")).Return(itemsPerPage + 1);
            reader.Stub(x => x.GetInt32NullAsZero("SiteID")).Return(siteId);
            reader.Stub(x => x.DoesFieldExist("ForumPostCount")).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("ForumPostCount")).Return(itemsPerPage + 1);
            reader.Stub(x => x.GetDateTime("ThreadLastUpdated")).Return(DateTime.MinValue);
            reader.Stub(x => x.GetDateTime("ForumLastUpdated")).Return(DateTime.MinValue);



            creator = mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("forumgetthreadlist")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("GetForumSiteID")).Return(reader);
            creator.Stub(x => x.CreateDnaDataReader("cachegetforumlastupdate")).Return(reader);



            var site = mocks.DynamicMock<ISite>();
            site.Stub(x => x.SiteID).Return(siteId);
            site.Stub(x => x.IsEmergencyClosed).Return(false);
            site.Stub(x => x.IsSiteScheduledClosed(DateTime.Now)).Constraints(Is.Anything()).Return(false);

            siteList = mocks.DynamicMock<ISiteList>();
            siteList.Stub(x => x.GetSite(1)).Return(site);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:44,代码来源:ForumThreadsTest.cs

示例15: GetSiteForForumIdTestSetup

        private static void GetSiteForForumIdTestSetup(out MockRepository mocks, out IDnaDataReaderCreator creator,
                                                       out ISiteList siteList)
        {
            const int siteId = 1;
            mocks = new MockRepository();
            var reader = mocks.DynamicMock<IDnaDataReader>();
            reader.Stub(x => x.HasRows).Return(true);
            reader.Stub(x => x.Read()).Return(true);
            reader.Stub(x => x.GetInt32NullAsZero("SiteID")).Return(siteId);

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


            var site = mocks.DynamicMock<ISite>();
            site.Stub(x => x.SiteID).Return(siteId);

            siteList = mocks.DynamicMock<ISiteList>();
            siteList.Stub(x => x.GetSite(siteId)).Return(site);
            mocks.ReplayAll();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:21,代码来源:ForumThreadsTest.cs


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