public void Should_be_able_to_foreach()
        {
            var scanner = AssemblyScanner.FindDescriptorsInAssemblyContaining <TestDescriptor>();
            var count   = 0;

            scanner.ForEach(x => count++);

            Assert.Equal(1, count);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var formatter = new WebApiJsonFormatter();

            AssemblyScanner.FindDescriptorsInAssemblyContaining <Program>()
            .ForEach(x => {
                formatter.AddDescriptor(x);
            });

            var output = formatter.Format();

            System.Console.WriteLine(output);
        }
        public void Should_be_able_to_set_activator()
        {
            var count   = 0;
            var scanner = AssemblyScanner
                          .FindDescriptorsInAssemblyContaining <TestDescriptor>()
                          .SetActivator(t =>
            {
                count++;
                return(Activator.CreateInstance(t) as IDescriptor <IDescriptorContainer>);
            }).ToList();

            Assert.Equal(1, count);
        }
        public void Should_be_able_to_find_descriptors_in_asembly()
        {
            var scanner = AssemblyScanner.FindDescriptorsInAssemblyContaining <TestDescriptor>();

            Assert.Equal(1, scanner.Count());
        }