コード例 #1
0
    public static void ExtensionCollectionPublicMembersTest()
    {
        ExtensionCollection <IMyExtensibleObject> collection = new ExtensionCollection <IMyExtensibleObject>(new MyExtensibleObject(), "syncRoot");

        collection.Add(new MyExtension1());
        collection.Add(new MyExtension2());

        Assert.True(collection.Count == 2, $"Expected the collection to contain 2 items, instead it contained '{collection.Count}' items.");

        IMyExtension result = collection.Find <IMyExtension>();

        Assert.NotNull(result);

        Collection <IMyExtension> myCollection = collection.FindAll <IMyExtension>();

        Assert.True(myCollection.Count == 2, $"Expected the collection to contain 2 items of type 'IMyExtension', instead it contained: '{myCollection.Count}' items.");
    }