GetTypes() public method

public GetTypes ( ) : IEnumerable
return IEnumerable
 public void Test_GetTypes_WhenAddToTypeSource_ShouldReturnAllTypesImplementingIBoInterface()
 {
     //---------------Set up test pack-------------------
     var typeSource = new DummyTypeSourceWithMockItems();
     IEnumerable<TypeWrapper> types1 = typeSource.GetTypes();
     var typeSource2 = new DummyTypeSourceWithMockItems(1);
     IEnumerable<TypeWrapper> types2 = typeSource2.GetTypes();
     var multiTypeSource = new MultiTypeSource(new []{typeSource});
     //---------------Assert Precondition----------------
     multiTypeSource.GetTypes().ShouldHaveCount(4, "The firstType Should be loaded");
     //---------------Execute Test ----------------------
     multiTypeSource.TypeSources.Add(typeSource2);
     var types = multiTypeSource.GetTypes();
     //---------------Test Result -----------------------
     Assert.IsNotNull(types);
     types.ShouldHaveCount(types1.Count() + types2.Count());
     types.ShouldContain(types1, "Should Contain all Items in Type One");
     types.ShouldContain(types2, "Should Contain all Items in Type Two");
 }
Esempio n. 2
0
        public void Test_GetTypes_WhenAddToTypeSource_ShouldReturnAllTypesImplementingIBoInterface()
        {
            //---------------Set up test pack-------------------
            var typeSource = new DummyTypeSourceWithMockItems();
            IEnumerable <TypeWrapper> types1 = typeSource.GetTypes();
            var typeSource2 = new DummyTypeSourceWithMockItems(1);
            IEnumerable <TypeWrapper> types2 = typeSource2.GetTypes();
            var multiTypeSource = new MultiTypeSource(new [] { typeSource });

            //---------------Assert Precondition----------------
            multiTypeSource.GetTypes().ShouldHaveCount(4, "The firstType Should be loaded");
            //---------------Execute Test ----------------------
            multiTypeSource.TypeSources.Add(typeSource2);
            var types = multiTypeSource.GetTypes();

            //---------------Test Result -----------------------
            Assert.IsNotNull(types);
            types.ShouldHaveCount(types1.Count() + types2.Count());
            types.ShouldContain(types1, "Should Contain all Items in Type One");
            types.ShouldContain(types2, "Should Contain all Items in Type Two");
        }