public void Assembly_should_add_scanner_to_configurator_when_called_with_path()
        {
            using (var factory = new AssemblyFactory())
            {
                var configurator =
                    new TypeScannerConfigurator();

                var builtAssembly =
                    factory.Build(
                        @"
                        public class Foo { }
                        class Bar { }
                        public interface IFoo { }
                        interface IBar { }
                        public abstract class Baz { }
                    ");

                configurator.Assembly((string)builtAssembly);

                var scanner =
                    configurator.GetTypeScanner();

                var results =
                    scanner.GetTypes(x => true);

                results.Count().ShouldEqual(1);
            }
        }
        public void Assembly_should_throw_argumentnullexception_when_called_with_null_path()
        {
            var configurator =
                new TypeScannerConfigurator();

            var exception =
                Catch.Exception(() => configurator.Assembly((string)null));

            exception.ShouldBeOfType <ArgumentNullException>();
        }
        public void Assembly_should_return_reference_to_same_configurator_when_called_with_assembly()
        {
            var configurator =
                new TypeScannerConfigurator();

            var reference =
                configurator.Assembly(Assembly.GetExecutingAssembly());

            reference.ShouldBeSameAs(configurator);
        }
        public void Assembly_should_return_reference_to_same_configurator_when_called_with_expression()
        {
            var configurator =
                new TypeScannerConfigurator();

            var reference =
                configurator.Assembly(x => x.FullName.Length > 0);

            reference.ShouldBeSameAs(configurator);
        }
        public void Assembly_should_throw_filenotfoundexception_when_called_with_invalid_path()
        {
            var configurator =
                new TypeScannerConfigurator();

            var path =
                Environment.GetFolderPath(Environment.SpecialFolder.Windows);

            var exception =
                Catch.Exception(() => configurator.Assembly(path));

            exception.ShouldBeOfType <FileNotFoundException>();
        }
        public void Assembly_should_add_scanner_to_configurator_when_called_with_expression()
        {
            var configurator =
                new TypeScannerConfigurator();

            configurator.Assembly(x => true);

            var scanner =
                configurator.GetTypeScanner();

            var results =
                scanner.GetTypes(x => x.Equals(typeof(FakePart)));

            results.Count().ShouldEqual(1);
        }
        public void Assembly_should_return_reference_to_same_configurator_when_called_with_path()
        {
            using (var factory = new AssemblyFactory())
            {
                var configurator =
                    new TypeScannerConfigurator();

                var assembly =
                    factory.Build(@"public class Foo { }");

                var reference =
                    configurator.Assembly((string)assembly);

                reference.ShouldBeSameAs(configurator);
            }
        }