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


C# IInputContext.CreateDnaDataReader方法代码示例

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


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

示例1: RequestIPAddress

        /// <summary>
        /// Request the IP Address of a post.
        /// </summary>
        /// <param name="entryId"></param>
        /// <param name="reason"></param>
        /// <param name="context"></param>
        /// <param name="modId"></param>
        /// <returns></returns>
        public string RequestIPAddress(int entryId, string reason, int modId, IInputContext context)
        {
            using (IDnaDataReader reader = context.CreateDnaDataReader("getipaddressforthreadentry"))
            {
                reader.AddParameter("entryid", entryId);
                reader.AddParameter("userid", context.ViewingUser.UserID);
                reader.AddParameter("reason", reason);
                reader.AddParameter("modid", modId);
                reader.Execute();

                if (reader.HasRows)
                {
                    reader.Read();
					if (reader.DoesFieldExist("DatePosted") && !reader.IsDBNull("DatePosted"))
					{
						return string.Format("{0}\r\nPosted: {1}", reader[0].ToString(), reader["DatePosted"]);
					}
					else
					{
						return reader[0].ToString();
					}
                }
            }
            return "";
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:IPAddressRequester.cs

示例2: SetupArticles

        void SetupArticles(IInputContext context)
        {
            int entryID = 0;
            int h2g2ID = 0;
            //create a dummy article

            using (IDnaDataReader reader = context.CreateDnaDataReader("createguideentry"))
            {
                reader.AddParameter("subject", "TEST ARTICLE");
                reader.AddParameter("bodytext", "TEST ARTICLE");
                reader.AddParameter("extrainfo", "<EXTRAINFO>TEST ARTICLE</EXTRAINFO>");
                reader.AddParameter("editor", 6);
                reader.AddParameter("typeid", 3001);
                reader.AddParameter("status", 3);

                reader.Execute();
                Assert.IsTrue(reader.Read(), "Article not created");
                entryID = reader.GetInt32NullAsZero("entryid");
                h2g2ID = reader.GetInt32NullAsZero("h2g2id");

                Assert.IsTrue(entryID != 0, "Article not created");
            }

            int recommendationID = 0;
            //recommnend article...
            using (IDnaDataReader reader = context.CreateDnaDataReader("storescoutrecommendation"))
            {
                reader.AddParameter("entryid", entryID);
                reader.AddParameter("@comments", "scout comment");
                reader.AddParameter("scoutid", 6);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Recommendation not created");
                recommendationID = reader.GetInt32NullAsZero("RecommendationID");
                Assert.IsTrue(recommendationID != 0, "Recommendation not created");
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:36,代码来源:ArticleListTests.cs

示例3: CreateAndRecommendAndAllocateArticle

        void CreateAndRecommendAndAllocateArticle(IInputContext context)
        {
            using (IDnaDataReader reader = context.CreateDnaDataReader("updateuser"))
            {
                reader.AddParameter("userid", 6);
                reader.AddParameter("email", "[email protected]");
                reader.Execute();
            }

            int entryID = 0;
            int h2g2ID = 0;
            //create a dummy article

            using (IDnaDataReader reader = context.CreateDnaDataReader("createguideentry"))
            {
                reader.AddParameter("subject", "TEST ARTICLE");
                reader.AddParameter("bodytext", "TEST ARTICLE");
                reader.AddParameter("extrainfo", "<EXTRAINFO>TEST ARTICLE</EXTRAINFO>");
                reader.AddParameter("editor", 6);
                reader.AddParameter("typeid", 3001);
                reader.AddParameter("status", 3);

                reader.Execute();
                Assert.IsTrue(reader.Read(), "Article not created");
                entryID = reader.GetInt32NullAsZero("entryid");
                h2g2ID = reader.GetInt32NullAsZero("h2g2id");

                Assert.IsTrue(entryID != 0, "Article not created");
            }

            int recommendationID = 0;
            //recommnend article...
            using (IDnaDataReader reader = context.CreateDnaDataReader("storescoutrecommendation"))
            {
                reader.AddParameter("entryid", entryID);
                reader.AddParameter("@comments", "scout comment");
                reader.AddParameter("scoutid", 6);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Recommendation not created");
                recommendationID = reader.GetInt32NullAsZero("RecommendationID");
                Assert.IsTrue(recommendationID != 0, "Recommendation not created");
            }

            int newH2G2ID = 0;
            //accept the recommendation
            using (IDnaDataReader reader = context.CreateDnaDataReader("acceptscoutrecommendation"))
            {
                reader.AddParameter("recommendationid", recommendationID);
                reader.AddParameter("comments", "acceptor comment");
                reader.AddParameter("acceptorid", 6);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Recommendation not accepted");
                Assert.IsTrue(reader.GetTinyIntAsInt("Success") == 1, "Recommendation not accepted");
                newH2G2ID = reader.GetInt32NullAsZero("h2g2ID");
                Assert.IsTrue(newH2G2ID != 0, "Recommendation not created");
            }
            //allocate the recommendation
            using (IDnaDataReader reader = context.CreateDnaDataReader("AllocateEntriesToSub"))
            {
                reader.AddParameter("subid", 6);
                reader.AddParameter("comments", "allocator comment");
                reader.AddParameter("AllocatorID", 6);
                reader.AddParameter("id0", newH2G2ID / 10);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Allocation not accepted");
                Assert.IsTrue(reader.GetInt32NullAsZero("EntryID") == newH2G2ID / 10, "Allocation not accepted");
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:68,代码来源:SubNotificationEmailTests.cs

示例4: SetupPreModPost

        /// <summary>
        /// Creates a new premod posting post in the mod queue
        /// </summary>
        /// <param name="context">The context for the request</param>
        /// <param name="forumid">The forumid that was posted to</param>
        /// <param name="subject">The subject used for the post</param>
        /// <param name="modID">The modid for the new moderation item</param>
        private static void SetupPreModPost(IInputContext context, out int forumid, out string subject, out int modID)
        {
            // Now create a new user to play with
            DnaTestURLRequest request = new DnaTestURLRequest("haveyoursay");
            request.SetCurrentUserNormal();
            int userID = request.CurrentUserID;

            using (IDnaDataReader reader = context.CreateDnaDataReader("FindUserFromID"))
            {
                reader.AddParameter("UserID",userID);
                reader.Execute();

                Assert.IsTrue(reader.HasRows, "No rows came back from the FindUserFromID storedprocedure");
                Assert.IsTrue(reader.Read(), "Failed to read the first set of results from the FindUserFromID storedprocedure");
                Assert.AreEqual(userID, reader.GetInt32("UserID"), "The userid should come back as normal userid, as that's the id we wanted to get!");
                Assert.AreEqual("DotNetNormalUser", reader.GetString("UserName"), "The user name has been changed in the small guide.");
                Assert.AreEqual(1, reader.GetInt32("Status"), "The status of this user should be 1, normal user");
                Assert.IsFalse(reader.GetBoolean("BannedFromComplaints"), "The use should not be banned from complaints at this stage");
            }

            // Find a forum to post to
            forumid = 0;
            using (IDnaDataReader reader = context.CreateDnaDataReader(""))
            {
                reader.ExecuteDEBUGONLY("select top 1 * from forums where siteid = 1 and title not in ('','User-journal','frontpage') and canread=1 order by forumid desc");
                if (reader.Read() && reader.HasRows)
                {
                    forumid = reader.GetInt32("ForumID");
                }
                Assert.AreNotEqual(0, forumid, "Failed to find a good forum to test against");
            }

            // Set the site to be in premodposting mode
            using (IDnaDataReader reader = context.CreateDnaDataReader("SetSiteOption"))
            {
                reader.AddParameter("SiteID", 1);
                reader.AddParameter("Section", "Moderation");
                reader.AddParameter("Name", "ProcessPreMod");
                reader.AddParameter("Value", "1");
                reader.Execute();
            }

            // Now post to the forum
            subject = "Testing move thread details";
            string content = "Testing move thread details with premod posting";
            using (IDnaDataReader reader = context.CreateDnaDataReader("PostToForum"))
            {
                reader.AddParameter("userid", userID);
                reader.AddParameter("forumid", forumid);
                reader.AddParameter("inreplyto", DBNull.Value);
                reader.AddParameter("threadid", 0);
                reader.AddParameter("subject", subject);
                reader.AddParameter("content", content);
                reader.AddParameter("poststyle", 2);
                reader.AddParameter("hash", Guid.NewGuid().ToString());
                reader.AddParameter("keywords", "");
                reader.AddParameter("forcepremoderation", 1);
                reader.Execute();

                if (!reader.Read() || !reader.HasRows)
                {
                    Assert.Fail("Failed to create a new post for the test.");
                }

                Assert.IsTrue(reader.GetInt32("PreModPostingModId") > 0, "The last post did not go in as a premod posting!");
            }

            // check to make sure the thread is in the mod table
            modID = 0;
            using (IDnaDataReader reader = context.CreateDnaDataReader(""))
            {
                reader.ExecuteDEBUGONLY("Select top 1 pm.modid,pm.forumid,pm.subject,pm.body,tm.IsPreModPosting from threadmod tm inner join premodpostings pm on pm.modid = tm.modid order by modid desc");
                Assert.IsTrue(reader.Read() && reader.HasRows, "Failed to get the moderated post");
                Assert.AreEqual(subject, reader.GetString("subject"), "We didn't find the moderated post");
                Assert.AreEqual(content, reader.GetString("body"), "We didn't find the moderated post");
                Assert.AreEqual(forumid, reader.GetInt32("forumid"), "We didn't find the moderated post");
                Assert.AreEqual(1, reader.GetTinyIntAsInt("IsPreModPosting"), "The post went in, but not as a premod posting");
                modID = reader.GetInt32("ModID");
                Assert.IsTrue(modID > 0, "The moderation id is 0!");
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:88,代码来源:MoveThreadTests.cs

示例5: RegisterTestComplaint

        private static int RegisterTestComplaint(IInputContext context, int postId, int userId, int modId, string email, string complaintText, string IpAddress, Guid BBCUid)
        {
            var code = Guid.Empty;
            using (IDnaDataReader dataReader = context.CreateDnaDataReader("registerpostingcomplaint"))
            {
                dataReader.AddParameter("complainantid", userId);
                dataReader.AddParameter("correspondenceemail", email);
                dataReader.AddParameter("postid", postId);
                dataReader.AddParameter("complainttext", complaintText);
                dataReader.AddParameter("ipaddress", IpAddress);
                dataReader.AddParameter("bbcuid", BBCUid);

                //HashValue
                Guid hash = DnaHasher.GenerateHash(Convert.ToString(userId) + ":" + email + ":" + Convert.ToString(postId) + ":" + complaintText);
                dataReader.AddParameter("hash", hash);
                dataReader.Execute();

                // Send Email
                if (dataReader.Read())
                {
                    if(dataReader.DoesFieldExist("modid"))
                    {
                        modId = dataReader.GetInt32NullAsZero("modId");
                    }
                    if (dataReader.DoesFieldExist("verificationUid"))
                    {
                        code = dataReader.GetGuid("verificationUid");
                    }
                }
            }

            if (code != Guid.Empty)
            {//submit verification code

                using (IDnaDataReader dataReader = context.CreateDnaDataReader("registerverifiedcomplaint"))
                {
                    dataReader.AddParameter("verificationcode", code);
                    dataReader.Execute();

                    if (dataReader.HasRows && dataReader.Read())
                    {
                        modId = dataReader.GetInt32NullAsZero("modid");
                    }
                }

            }

            Assert.AreNotEqual(0, modId);
            return modId;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:50,代码来源:ModerationHistoryTests.cs

示例6: CreateUserInDatabase

        /// <summary>
        /// Helper method for creating a new user in the database
        /// </summary>
        /// <param name="context">The context in which to create the data reader</param>
        /// <returns>The id of the new user</returns>
        private static int CreateUserInDatabase(IInputContext context)
        {
            int ssoUserID = _currentTestUserID++;
            int userID = 0;
            using (IDnaDataReader reader = context.CreateDnaDataReader("createnewuserfromssoid"))
            {
                reader.AddParameter("ssouserid", ssoUserID);
                reader.AddParameter("UserName", "TestUser" + ssoUserID.ToString());
                reader.AddParameter("Email", "[email protected]");
                reader.AddParameter("SiteID", 1);
                reader.AddParameter("FirstNames", "MR");
                reader.AddParameter("LastName", "TESTER");
                reader.Execute();

                // Check to make sure that we got something back
                Assert.IsTrue(reader.HasRows, "Creating a new user returned no data!");
                Assert.IsTrue(reader.Read(), "Failed to read the first row of data!");

                // Get the new user id
                userID = reader.GetInt32("UserID");

                // Now check the values comming back from the database
                Assert.AreEqual("TestUser" + ssoUserID.ToString(), reader.GetString("LoginName"), "Users login name does not match the one entered");
                Assert.AreEqual("TestUser" + ssoUserID.ToString(), reader.GetString("UserName"), "Users name does not match the one entered");
                Assert.IsTrue(String.IsNullOrEmpty(reader.GetStringNullAsEmpty("FirstNames")), "Users first name should be null");
                Assert.IsTrue(String.IsNullOrEmpty(reader.GetStringNullAsEmpty("LastName")), "The users last name should be null");
                Assert.AreEqual("[email protected]", reader.GetString("Email"), "The users email does not match the one entered");
                

                // Here are the important ones for this test
                Assert.IsTrue(reader.GetDateTime("DateJoined") > DateTime.Now.AddMinutes(-1), "The users date joined value is not with in the tolarences of this test!");
                Assert.AreEqual(0, reader.GetTinyIntAsInt("AutoSinBin"), "The user shouldn't be in the auto sin bin!");
                Assert.AreEqual(1, reader.GetTinyIntAsInt("Status"), "The user status is not correct");
                Assert.AreEqual(0, reader.GetTinyIntAsInt("PrefStatus"), "The user pref status is not correct");
            }
            return userID;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:42,代码来源:UserPrefStatusTests.cs

示例7: CheckUsersPrefStatus

        /// <summary>
        /// Helper method that checks the users current prefstatus against an expected value
        /// </summary>
        /// <param name="context">The context in which to create the data reader</param>
        /// <param name="userID">The id of the user you want to check the status for</param>
        /// <param name="expectedPrefStatus">The expected value for the users current pref status</param>
        private static void CheckUsersPrefStatus(IInputContext context, int userID, int expectedPrefStatus)
        {
            using (IDnaDataReader reader = context.CreateDnaDataReader("getmemberprefstatus"))
            {
                reader.AddParameter("UserID", userID);
                reader.AddParameter("SiteID", 1);
                reader.AddIntOutputParameter("PrefStatus");
                reader.Execute();

                // Check to make sure that we got something back
                int prefStatus = -1;
                reader.TryGetIntOutputParameter("PrefStatus", out prefStatus);
                Assert.AreEqual(expectedPrefStatus, prefStatus, "The users pref status should be " + expectedPrefStatus.ToString());
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:21,代码来源:UserPrefStatusTests.cs

示例8: CheckUserBelongsToGroup

        /// <summary>
        /// Helper method that checks to see if the us4er belongs to a given group
        /// </summary>
        /// <param name="context">The context in which to create the data reader</param>
        /// <param name="userID">The id of the user you want to check the groups for</param>
        /// <param name="groupToCheck">The group that you want to see if the user is a member of</param>
        /// <param name="expectedResult">The exspected result from the query</param>
        private static void CheckUserBelongsToGroup(IInputContext context, int userID, string groupToCheck, bool expectedResult)
        {
            using (IDnaDataReader reader = context.CreateDnaDataReader("isusermemberofgroup"))
            {
                reader.AddParameter("UserID", userID);
                reader.AddParameter("SiteID", 1);
                reader.AddParameter("GroupName", groupToCheck);
                reader.AddIntOutputParameter("Exists");
                reader.Execute();

                // Check to make sure that we got something back
                int isMember = -1;
                reader.TryGetIntOutputParameter("Exists", out isMember);
                if (expectedResult)
                {
                    Assert.IsTrue(isMember > 0, "The user should belong to the group - " + groupToCheck);
                }
                else
                {
                    Assert.IsTrue(isMember == 0, "The user should not belong to the group - " + groupToCheck);
                }
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:30,代码来源:UserPrefStatusTests.cs

示例9: SetUsersModerationStatus

 /// <summary>
 /// Helper method for setting the users pref status via the stored procedures
 /// </summary>
 /// <param name="context">The context in which to create the data reader</param>
 /// <param name="userID">The id of the user you want to update the status for</param>
 /// <param name="prefStatus">The new status for the user.
 /// 0 = normal
 /// 1 = premod
 /// 2 = postmod
 /// 3 = for review
 /// 4 = banned / restricted</param>
 private static void SetUsersModerationStatus(IInputContext context, int userID, int prefStatus)
 {
     using (IDnaDataReader reader = context.CreateDnaDataReader("updatetrackedmemberlist"))
     {
         reader.AddParameter("UserIDs", userID.ToString());
         reader.AddParameter("SiteIDs", 1);
         reader.AddParameter("PrefStatus", prefStatus);
         reader.AddParameter("PrefStatusDuration", 0);
         reader.Execute();
     }
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:22,代码来源:UserPrefStatusTests.cs

示例10: CreateAComment

		private int CreateAComment(int normalUserid, IInputContext inputContext, string commenttext, string hash)
		{
			int thisPostId = 0;
			using (IDnaDataReader reader = inputContext.CreateDnaDataReader("createcomment"))
			{
				//exec createcomment 
				//@uniqueid=N'comments1_shtml123456',
				//@userid=6,
				//@content=N'blardy blah blah',
				//@hash='B0E9D576-2371-F9BF-5BF8-C6203E80EB14',
				//@forcemoderation=0,
				//@ignoremoderation=1,
				//@isnotable=1
				reader.AddParameter("@uniqueid", _uid)
				.AddParameter("@userid", normalUserid)
                .AddParameter("@siteid", 54)
				.AddParameter("@content", commenttext)
				.AddParameter("@hash", hash)
				.AddParameter("@forcemoderation", "0")
				.AddParameter("@ignoremoderation", 0)
				.AddParameter("@isnotable", 0)
                .AddParameter("@poststyle", 2)
				.Execute();
				Assert.IsTrue(reader.Read(), "Checking that createcomment returns a row");
				thisPostId = reader.GetInt32("postid");
			}
			return thisPostId;
		}
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:28,代码来源:PostingSprocTests.cs

示例11: ModeratePosts

		private static void ModeratePosts(int moderatorUserId, int normalUserid, IInputContext inputContext)
		{
			using (IDnaDataReader reader = inputContext.CreateDnaDataReader("getmoderationposts"))
			{
				reader.AddParameter("@userid", moderatorUserId)
				.AddParameter("@alerts", 0)
				.AddParameter("@lockeditems", 0)
				.AddParameter("@issuperuser", 0)
				.AddParameter("@modclassid", 5)
				.AddParameter("@show", 10)
				.AddParameter("@fastmod", 0);
				reader.Execute();
				Assert.IsTrue(reader.Read(), "Expecting at least one post to moderate");
				do
				{
					int forumId = reader.GetInt32NullAsZero("ForumID");
					int threadId = reader.GetInt32NullAsZero("ThreadID");
					int postId = reader.GetInt32NullAsZero("EntryID");
					int modID = reader.GetInt32NullAsZero("ModID");
					using (IDnaDataReader subreader = inputContext.CreateDnaDataReader("moderatepost"))
					{
						subreader.AddParameter("@forumid", forumId)
						.AddParameter("@threadid", threadId)
						.AddParameter("@postid", postId)
						.AddParameter("@modid", modID)
						.AddParameter("@status", 3)
						.AddParameter("@notes", "")
						.AddParameter("@referto", 0)
						.AddParameter("@referredby", moderatorUserId)
						.AddParameter("@moderationstatus", 0);
						subreader.Execute();
						Assert.IsTrue(subreader.Read(), "moderatepost expects a single row");
						Assert.IsTrue(subreader.GetInt32NullAsZero("PostID") > 0, "PostID should be non-zero after processing");
						Assert.AreEqual(subreader.GetInt32NullAsZero("AuthorID"), normalUserid, "Testing that posting user IDs match");
						Assert.IsFalse(subreader.Read(), "Only expecting a single row of data");
					}

				} while (reader.Read());

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

示例12: ModeratePostUpdateEntry

        private void ModeratePostUpdateEntry(int moderatorUserId, IInputContext inputContext)
        {
            int processedThreadID=0;
            using (IDnaDataReader reader = inputContext.CreateDnaDataReader("getmoderationposts"))
            {
                reader.AddParameter("@userid", moderatorUserId);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Expecting at least one post to moderate");
                do
                {
                    int forumId = reader.GetInt32NullAsZero("ForumID");
                    int threadId = reader.GetInt32NullAsZero("ThreadID");
                    int postId = reader.GetInt32NullAsZero("EntryID");
                    int modID = reader.GetInt32NullAsZero("ModID");
                    using (IDnaDataReader subreader = inputContext.CreateDnaDataReader("moderatepost"))
                    {
                        subreader.AddParameter("@forumid", forumId)
                        .AddParameter("@threadid", threadId)
                        .AddParameter("@postid", postId)
                        .AddParameter("@modid", modID)
                        .AddParameter("@status", 3)
                        .AddParameter("@notes", "")
                        .AddParameter("@referto", 0)
                        .AddParameter("@referredby", moderatorUserId)
                        .AddParameter("@moderationstatus", 0);
                        subreader.Execute();


                        Assert.IsTrue(subreader.Read(), "moderatepost expects a single row");
                        Assert.IsTrue(subreader.GetInt32NullAsZero("PostID") > 0, "PostID should be non-zero after processing");

                        processedThreadID = subreader.GetInt32NullAsZero("ThreadID");

                        int postid = subreader.GetInt32NullAsZero("PostID");
                    }

                } while (reader.Read());
            }

            string updateEntry = "UPDATE ThreadMod SET DateQueued='20050101' WHERE ThreadID = " + processedThreadID.ToString();

            //string server = GetServerName();

            using (IDnaDataReader reader = inputContext.CreateDnaDataReader(""))
            {
                reader.ExecuteDEBUGONLY(updateEntry);
            }

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

示例13: CreateUserInDatabase

        /// <summary>
        /// Helper method for creating a new user in the database
        /// </summary>
        /// <param name="context">The context in which to create the data reader</param>
        /// <param name="autoSinBinExpectedValue">The expected value for the autosinbin when checked</param>
        /// <returns>The id of the new user</returns>
        private static int CreateUserInDatabase(IInputContext context, int autoSinBinExpectedValue)
        {
            int userID = Int32.MaxValue - 1000000;
            using (IDnaDataReader reader = context.CreateDnaDataReader("createnewuserfromssoid"))
            {
                reader.AddParameter("ssouserid", userID);
                reader.AddParameter("UserName", "TestUser");
                reader.AddParameter("Email", "[email protected]");
                reader.AddParameter("SiteID", 1);
                reader.AddParameter("FirstNames", "MR");
                reader.AddParameter("LastName", "TESTER");
                reader.Execute();

                // Check to make sure that we got something back
                Assert.IsTrue(reader.HasRows, "Creating a new user returned no data!");
                Assert.IsTrue(reader.Read(), "Failed to read the first row of data!");

                // Now check the values comming back from the database
                userID = reader.GetInt32("UserID");
                Assert.AreNotEqual(0, reader.GetInt32("UserID"), "UserId does not match the one entered");
                Assert.AreEqual("TestUser", reader.GetString("LoginName"), "Users login name does not match the one entered");
                Assert.AreEqual("TestUser", reader.GetString("UserName"), "Users name does not match the one entered");

                //**************************************************************************************
                // SPF 3/12/09 Due to the removal of First Names Last Name due to legal issues,
                // the First Names and Last Name will be NULL
                //**************************************************************************************
                Assert.IsTrue(reader.IsDBNull("FirstNames"), "Users first name is not NULL");
                Assert.IsTrue(reader.IsDBNull("LastName"), "The users last name is not NULL");
                // *************************************************************************************

                Assert.AreEqual("[email protected]", reader.GetString("Email"), "The users email does not match the one entered");

                // Here are the important ones for this test
                Assert.IsTrue(reader.GetDateTime("DateJoined") > DateTime.Now.AddMinutes(-1), "The users date joined value is not with in the tolarences of this test!");
                Assert.AreEqual(autoSinBinExpectedValue, reader.GetTinyIntAsInt("AutoSinBin"), "The user should be in the auto sin bin!");
                Assert.AreEqual(1, reader.GetTinyIntAsInt("Status"), "The user status is not correct");
                Assert.AreEqual(0, reader.GetTinyIntAsInt("PrefStatus"), "The user pref status is not correct");
            }

            return userID;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:48,代码来源:AutoSinBinUserTests.cs


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