예제 #1
0
        public void can_iterate_through_families()
        {
            var graph = new GenericsPluginGraph();

            graph.FindFamily(typeof(IGenericService <>)).AddType(typeof(GenericService <>));
            graph.FindFamily(typeof(IService <>)).AddType(typeof(Service <>));

            graph.Families.Count().ShouldEqual(2);
        }
예제 #2
0
        public void Import_from_adds_all_new_PluginFamily_from_source()
        {
            var sourceFamily  = new PluginFamily(typeof(ISomething <>));
            var sourceFamily2 = new PluginFamily(typeof(ISomething2 <>));
            var sourceFamily3 = new PluginFamily(typeof(ISomething3 <>));
            var source        = new GenericsPluginGraph();

            source.AddFamily(sourceFamily);
            source.AddFamily(sourceFamily2);
            source.AddFamily(sourceFamily3);

            var destination = new GenericsPluginGraph();

            destination.ImportFrom(source);

            Assert.AreEqual(3, destination.FamilyCount);

            Assert.AreNotSame(sourceFamily, destination.FindFamily(typeof(ISomething <>)));
        }