public void FindsPublicConstructorsOnlyByDefault()
        {
            var finder = new DefaultConstructorFinder();
            var targetType = typeof(HasConstructors);
            var publicConstructor = targetType.GetConstructor(new Type[0]);

            var constructors = finder.FindConstructors(targetType).ToList();

            Assert.Equal(1, constructors.Count);
            Assert.Contains(publicConstructor, constructors);
        }
        public void FindsPublicConstructorsOnlyByDefault()
        {
            var finder = new DefaultConstructorFinder();
            var targetType = typeof(HasConstructors);
            var publicConstructor = targetType.GetConstructor(new Type[0]);

            var constructors = finder.FindConstructors(targetType).ToList();

            Assert.That(constructors, Has.Count.EqualTo(1));
            Assert.That(constructors, Has.Member(publicConstructor));
        }
        public void CanFindNonPublicConstructorsUsingFinderFunction()
        {
            var finder = new DefaultConstructorFinder(type => type.GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance));
            var targetType = typeof(HasConstructors);
            var privateConstructor = targetType.GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance).Single();

            var constructors = finder.FindConstructors(targetType).ToList();

            Assert.Equal(1, constructors.Count);
            Assert.Contains(privateConstructor, constructors);
        }
        public void CanFindNonPublicConstructorsUsingFinderFunction()
        {
            var finder = new DefaultConstructorFinder(type => type.GetConstructors(BindingFlags.NonPublic | BindingFlags.Instance));
            var targetType = typeof(HasConstructors);
            var privateConstructor = targetType.GetConstructor(
                BindingFlags.NonPublic | BindingFlags.Instance, null, new[] {typeof(int)}, null);

            var constructors = finder.FindConstructors(targetType).ToList();

            Assert.That(constructors, Has.Count.EqualTo(1));
            Assert.That(constructors, Has.Member(privateConstructor));
        }