本文整理汇总了C#中Article.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Article.Read方法的具体用法?C# Article.Read怎么用?C# Article.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Article
的用法示例。
在下文中一共展示了Article.Read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
Article a = new Article();
int id = a.Read() + 1;
a.prop_id = id;
a.prop_tittle = TextBox1.Text;
a.prop_paragraph = TextBox2.Text;
a.Write();
Button2_Click(sender, e);
TextBox1.Text = "";
TextBox2.Text = "";
}
示例2: TestDeleteArticle
public void TestDeleteArticle()
{
var article = new Article()
{
Header = "New article",
Text = "Text",
ArticleType = ArticleTypes.HotOffer
};
article.Create();
int id = article.Id;
article.Delete();
article.Read(id);
}
示例3: TestCreateAndReadArticle
public void TestCreateAndReadArticle()
{
var article = new Article()
{
Header = "New article",
Text = "Text",
ArticleType = ArticleTypes.HotOffer
};
Assert.AreEqual(0, article.Id);
article.Create();
Assert.IsTrue(article.Id > 0);
var sameArticle = new Article();
sameArticle.Read(article.Id);
Assert.AreEqual(article.Text, sameArticle.Text);
Assert.AreEqual(article.Header, sameArticle.Header);
Assert.AreEqual(article.Id, sameArticle.Id);
Assert.AreEqual(article.ArticleType, sameArticle.ArticleType);
}
示例4: TestUpdateArticle
public void TestUpdateArticle()
{
var article = new Article()
{
Header = "New article",
Text = "Text",
ArticleType = ArticleTypes.HotOffer
};
article.Create();
article.Header = "header 2";
article.Update();
article.Read();
Assert.AreEqual("header 2", article.Header);
}