本文整理汇总了C#中Google.GData.Client.Service.StreamInsert方法的典型用法代码示例。如果您正苦于以下问题:C# Service.StreamInsert方法的具体用法?C# Service.StreamInsert怎么用?C# Service.StreamInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google.GData.Client.Service
的用法示例。
在下文中一共展示了Service.StreamInsert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultHostInsertOneAndDelete
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/// <summary>[Test] creates a new entry, saves and loads it back</summary>
//////////////////////////////////////////////////////////////////////
[Test] public void DefaultHostInsertOneAndDelete()
{
Tracing.TraceMsg("Entering DefaultHostInsertOneAndDelete");
AtomEntry entry = ObjectModelHelper.CreateAtomEntry(1);
Service service = new Service();
FeedQuery query = new FeedQuery();
service.RequestFactory = this.factory;
int iCount=0;
string strTitle = "DefaultHostInsertOneAndDelete" + Guid.NewGuid().ToString();
entry.Title.Text = strTitle;
query.Uri = new Uri(this.defaultHost);
AtomFeed returnFeed = service.Query(query);
iCount = returnFeed.Entries.Count;
for (int i = 0; i < this.iIterations; i++)
{
Tracing.TraceMsg("DefaultHostInsertOneAndDelete, iteration : " + i);
Stream s = service.StreamInsert(new Uri(this.defaultHost), entry);
s.Close();
returnFeed = service.Query(query);
Assert.AreEqual(iCount+1, returnFeed.Entries.Count, "feed should have one more entry now");
AtomEntry returnEntry = null;
foreach (AtomEntry feedEntry in returnFeed.Entries )
{
if (String.Compare(feedEntry.Title.Text, strTitle) == 0)
{
// got him
returnEntry = feedEntry;
break;
}
}
Assert.IsTrue(returnEntry != null, "did not find the just inserted entry");
returnEntry.Delete();
// query again and check count
returnFeed = service.Query(query);
Assert.AreEqual(iCount, returnFeed.Entries.Count, "feed has different number of entries as expected");
}
}