コード例 #1
0
 internal protected TypeScope(RegisteredTypeFactory rfactory, string typeSpace = null)
 {
     Factory      = rfactory;
     Base         = typeof(T);
     TypeSpace    = typeSpace;
     TypeRegistry = rfactory
                    .Implementing(typeof(T))
                    .Where(t => !t.IsAbstract && !t.IsInterface && (null == TypeSpace || t.Assembly.GetName().Name == TypeSpace))
                    .ToDictionary <Type, XName>(t => t.XLabel());
 }
コード例 #2
0
        public void RegisteredTypeScopeTests()
        {
            var rtf       = new RegisteredTypeFactory(typeof(Xbim.Ifc4.EntityFactoryIfc4).Assembly, typeof(Xbim.Ifc2x3.EntityFactoryIfc2x3).Assembly);
            var wallScope = rtf.GetScopeOf <IIfcWall>();

            IsSameArrayElements(new string[] { "Xbim.Ifc4", "Xbim.Ifc2x3" }, rtf.TypeSpaces.ToArray());
            Assert.AreEqual(2, rtf.TypeSpaces.Count());
            Assert.AreEqual(5, wallScope.Implementations.Count());

            var wallScopeIfc4 = rtf.GetScopeOf <IIfcWall>("Xbim.Ifc4");

            Assert.AreEqual(3, wallScopeIfc4.Implementations.Count());
        }