public void find_loader_types()
        {
            var types = ApplicationLoaderFinder.FindLoaderTypes();

            types.ShouldContain(typeof(GoodApplicationSource));
            types.ShouldContain(typeof(FakeApplicationLoader));
        }
示例#2
0
        public static RemoteServiceRunner For <T>(Action <RemoteDomainExpression> configure = null)
        {
            ApplicationLoaderFinder.DetermineLoaderType(typeof(T));

            if (configure == null)
            {
                configure = x => { };
            }

            return(new RemoteServiceRunner(x => {
                configure(x);
                x.BootstrapperName = typeof(T).AssemblyQualifiedName;
            }));
        }
示例#3
0
        public void Start(string bootstrapperName, Dictionary <string, string> properties, MarshalByRefObject remoteListener)
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            //var domainSetup = AppDomain.CurrentDomain.SetupInformation;

            // TODO -- what the hell here? This is bad bad bad.
            //System.Environment.CurrentDirectory = domainSetup.ApplicationBase;

            // TODO -- need to handle exceptions gracefully here
            GlobalMessageTracking.Start((IRemoteListener)remoteListener);

            var loader = ApplicationLoaderFinder.FindLoader(bootstrapperName);

            _shutdown = loader.Load(properties);

            GlobalMessageTracking.SendMessage(new LoaderStarted
            {
                LoaderTypeName = _shutdown.GetType().FullName
            });
        }
 public void determine_loader_for_fuburegistry()
 {
     ApplicationLoaderFinder.DetermineLoaderType(typeof(StandinFubuRegistry))
     .ShouldBe(typeof(FubuRegistryLoader <StandinFubuRegistry>));
 }
 public void blows_up_if_more_than_one_application_source()
 {
     Exception <Exception> .ShouldBeThrownBy(() => { ApplicationLoaderFinder.FindLoader(null); })
     .Message.ShouldContain(
         "Found multiple candidates, you may need to specify an explicit selection in the bottle-service.config file.");
 }
 public void finds_bootstrapper_by_name()
 {
     ApplicationLoaderFinder.FindLoader(typeof(FakeApplicationLoader).AssemblyQualifiedName)
     .ShouldBeOfType <FakeApplicationLoader>();
 }
 public void build_application_loader_for_application_loader_type()
 {
     ApplicationLoaderFinder.BuildApplicationLoader(typeof(FakeApplicationLoader))
     .ShouldBeOfType <FakeApplicationLoader>();
 }
 public void building_an_activation_loader_for_a_bad_type_thows()
 {
     Exception <ArgumentOutOfRangeException> .ShouldBeThrownBy(
         () => { ApplicationLoaderFinder.BuildApplicationLoader(GetType()); });
 }
 public void application_source_with_no_default_ctor_is_not_candidate()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(AbstractApplicationSource))
     .ShouldBeFalse();
 }
 public void application_source_without_default_ctor_is_not_a_candidate()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(TemplatedApplicationSource))
     .ShouldBeFalse();
 }
 public void application_source_with_default_ctor_and_concrete_is_candidate()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(GoodApplicationSource))
     .ShouldBeTrue();
 }
 public void application_loader_is_not_candidate_if_no_default_ctor()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(TemplatedApplicationLoader))
     .ShouldBeFalse();
 }
 public void application_loader_is_not_candidate_if_abstract()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(AbstractApplicationLoader))
     .ShouldBeFalse();
 }
 public void concrete_type_of_application_loader_with_default_ctor_is_a_candidate()
 {
     ApplicationLoaderFinder.IsLoaderTypeCandidate(typeof(FakeApplicationLoader))
     .ShouldBeTrue();
 }
 public void build_loader_for_fuburegistry()
 {
     ApplicationLoaderFinder.BuildApplicationLoader(typeof(StandinFubuRegistry))
     .ShouldBeOfType <FubuRegistryLoader <StandinFubuRegistry> >();
 }