本文整理汇总了C#中PropertyCollection.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyCollection.GetProperty方法的具体用法?C# PropertyCollection.GetProperty怎么用?C# PropertyCollection.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyCollection
的用法示例。
在下文中一共展示了PropertyCollection.GetProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAdd
static void TestAdd(ref PropertyCollection collection, int count)
{
for (int i = 0; i < count; i++)
{
collection.SetProperty(i, i);
Assert.AreEqual(collection.GetProperty(i), i);
}
}
示例2: TestRemove
static void TestRemove(ref PropertyCollection collection, int count)
{
for (int i = 0; i < count; i++)
{
collection.RemoveProperty(i);
Assert.AreEqual(collection.GetProperty(i), null);
}
}
示例3: PropertyCollectionTest
public void PropertyCollectionTest()
{
var collection = new PropertyCollection();
for (int pass = 1; pass < 100; pass++)
{
collection.ClearProperties();
Assert.AreEqual(collection.Count, 0);
int count = pass * 2;
TestAdd(ref collection, count);
Assert.AreEqual(collection.Count, count);
TestRemove(ref collection, count);
Assert.AreEqual(collection.Count, 0);
TestAdd(ref collection, count);
Assert.AreEqual(collection.Count, count);
// delete every second property
for (int i = 0; i < count; i+=2)
{
collection.RemoveProperty(i);
Assert.AreEqual(collection.GetProperty(i), null);
}
Assert.AreEqual(collection.Count, count / 2);
// test property replacement
for (int i = 1; i < count; i += 2)
{
collection.SetProperty(i, i * 2);
Assert.AreEqual(collection.GetProperty(i), i * 2);
}
Assert.AreEqual(collection.Count, count / 2);
}
}
示例4: TestViewCreatedSetsNextHandlerOfTemplateCompletionHandler
public static void TestViewCreatedSetsNextHandlerOfTemplateCompletionHandler()
{
var viewProperties = new PropertyCollection();
var view = Substitute.For<IWpfTextView>();
view.Properties.Returns(viewProperties);
var viewAdapter = Substitute.For<IVsTextView>();
var adapterFactory = Substitute.For<IVsEditorAdaptersFactoryService>();
adapterFactory.GetWpfTextView(viewAdapter).Returns(view);
ITemplateEditorOptions options = OptionsWithCompletionListsEnabled(true);
var provider = new TemplateCompletionHandlerProvider(options, adapterFactory, Substitute.For<SVsServiceProvider>(), Substitute.For<ICompletionBroker>());
provider.VsTextViewCreated(viewAdapter);
var handler = (TemplateCompletionHandler)viewProperties.GetProperty(typeof(TemplateCompletionHandler));
viewAdapter.Received().AddCommandFilter(handler, out handler.NextHandler);
}