Esempio n. 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="maxThreads"></param>
 /// <param name="interfaceExtractor"></param>
 /// <param name="dataDirectory"></param>
 /// <param name="outputDirectory"></param>
 public void Initialise(int maxThreads,
                        InterfaceExtractor interfaceExtractor,
                        string dataDirectory,
                        string outputDirectory)
 {
     this.maxThreads = maxThreads;
     this.interfaceExtractor = interfaceExtractor;
     this.dataDirectory = dataDirectory;
     this.outputDirectory = outputDirectory;
 }
        public void InterfaceExtractorShouldReturnTheCorrectResults()
        {
            var baseType   = typeof(SampleClass);
            var extractor  = new InterfaceExtractor();
            var interfaces = new HashSet <Type>();

            extractor.GetInterfaces(baseType, interfaces);

            Assert.IsTrue(interfaces.Contains(typeof(ISampleService)));
            Assert.IsTrue(interfaces.Contains(typeof(ISampleGenericService <int>)));

            // The result list must only contain interface types
            var nonInterfaceTypes = from t in interfaces
                                    where !t.IsInterface
                                    select t;

            Assert.IsTrue(nonInterfaceTypes.Count() == 0);
        }