コード例 #1
0
        public void Bootstrap(string watchToken)
        {
            _watchToken = watchToken;
            BootStrapper.Configure(new LocalAppDataConfigurationLocator("AutoTest.config.template.VS"));
            BootStrapper.Container
            .Register(Component.For <IMessageProxy>()
                      .Forward <IRunFeedbackView>()
                      .Forward <IInformationFeedbackView>()
                      .Forward <IConsumerOf <AbortMessage> >()
                      .ImplementedBy <MessageProxy>().LifeStyle.Singleton);

            BootStrapper.Services
            .Locate <IRunResultCache>().EnabledDeltas();
            BootStrapper.InitializeCache(_watchToken);
            BootStrapper.Services
            .Locate <IMessageProxy>()
            .SetMessageForwarder(new FeedbackListener(_window));

            _configuredCustomOutput = BootStrapper.Services.Locate <IConfiguration>().CustomOutputPath;
            _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>();
            _watcher.Watch(_watchToken);
            _window.DebugTest += new EventHandler <UI.DebugTestArgs>(_window_DebugTest);
            _window.SetMessageBus(BootStrapper.Services.Locate <IMessageBus>());
            setCustomOutputPath();
            _window.Clear();
        }
コード例 #2
0
 public static void Configure()
 {
     BootStrapper.Configure();
     BootStrapper.Container
     .AddFacility("logging", new LoggingFacility(LoggerImplementation.Console));
     BootStrapper.Container.Register(Component.For <IConsoleApplication>().ImplementedBy <ConsoleApplication>());
 }
コード例 #3
0
ファイル: Global.asax.cs プロジェクト: multiton/ORM
        public WebApiApplication() : base()
        {
            this.container = BootStrapper.Configure();

            // this.container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.NLog).WithConfig("NLog.config"));
            this.container.Register(Classes.FromThisAssembly().BasedOn <IHttpController>().LifestylePerWebRequest());
        }
コード例 #4
0
ファイル: OrderRepositoryTest.cs プロジェクト: multiton/ORM
        public void CreateOrderItem()
        {
            var item = new OrderItem
            {
                Quantity = 3,
                Price    = 2500.00m,
                Product  = new Product {
                    Id = 1
                },
                Order = new OrderHeader {
                    Id = 4
                }
            };

            using (var container = BootStrapper.Configure())
            {
                var repository = container.Resolve <IRepository <OrderItem> >();

                repository.Attach(item.Product);
                repository.Attach(item.Order);

                repository.Add(item);
                repository.SaveChanges();
            }
        }
コード例 #5
0
ファイル: OrderRepositoryTest.cs プロジェクト: multiton/ORM
        public void CreateOrder()
        {
            using (var container = BootStrapper.Configure())
            {
                var repository = container.Resolve <IOrderRepository>();

                repository.CreateOrder(new OrderHeader
                {
                    Number   = "150",
                    Supplier = new Company {
                        Id = 1
                    },
                    OdrerItems = new HashSet <OrderItem>
                    {
                        new OrderItem {
                            Quantity = 3, Price = 3.62m, Product = new Product {
                                Id = 1
                            }
                        },
                        new OrderItem {
                            Quantity = 5, Price = 4.12m, Product = new Product {
                                Id = 2
                            }
                        }
                    }
                });

                var count = repository.SaveChanges();
                Assert.AreEqual(count, 3);
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: jonwingfield/AutoTest.Net
 public static void bootstrapApplication()
 {
     BootStrapper.Configure();
     BootStrapper.Container
     .Register(Component.For <IOverviewForm>().ImplementedBy <FeedbackForm>())
     .Register(Component.For <IInformationForm>().ImplementedBy <InformationForm>())
     .Register(Component.For <IWatchDirectoryPicker>().ImplementedBy <WatchDirectoryPickerForm>());
 }
コード例 #7
0
        static void Main(string[] args)
        {
            using (var container = BootStrapper.Configure())
            {
                var orderDataComponent = container.Resolve <IOrderComponent>();

                OrderBuilder.AddSingleObjectGraph(orderDataComponent);
            }
        }
コード例 #8
0
    static void Main(string[] args)
    {
        Container container = new Container();

        BootStrapper.Configure(container);
        container.Verify();
        using (container.BeginLifetimeScope())
        {
            MainActivity entryPoint = container.GetInstance <MainActivity>();
            entryPoint.test();
        }
    }
コード例 #9
0
ファイル: Global.asax.cs プロジェクト: KhaledHarby/SharpIoc
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var container = new SharpIocContainter();

            BootStrapper.Configure(container);
            ControllerBuilder.Current.SetControllerFactory(new IocFactory(container));
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: noamkfir/AutoTest.Net
 public static void bootstrapApplication()
 {
     BootStrapper.Configure();
     BootStrapper.Container
     .Register(Component.For <IMessageProxy>()
               .Forward <IRunFeedbackView>()
               .Forward <IInformationFeedbackView>()
               .Forward <IConsumerOf <AbortMessage> >()
               .ImplementedBy <MessageProxy>().LifeStyle.Singleton)
     .Register(Component.For <IOverviewForm>().ImplementedBy <FeedbackForm>())
     .Register(Component.For <IInformationForm>().ImplementedBy <InformationForm>())
     .Register(Component.For <IWatchDirectoryPicker>().ImplementedBy <WatchDirectoryPickerForm>());
 }
コード例 #11
0
ファイル: OrderRepositoryTest.cs プロジェクト: multiton/ORM
        public void AddOrderItem()
        {
            var item = new OrderItem {
                Quantity = 3, Price = 2500.00m
            };

            using (var container = BootStrapper.Configure())
            {
                var repository = container.Resolve <IRepository <OrderItem> >();

                repository.Set(item, () => item.Product, 1);
                repository.Set(item, () => item.Order, 4);

                repository.Add(item);
                repository.SaveChanges();
            }
        }
コード例 #12
0
        static void Main(string[] args)
        {
            var exit = false;

            Console.CancelKeyPress += delegate {
                exit = true;
            };

            var arguments = ArgumentParser.Parse(args);

            if (arguments.Help)
            {
                Console.WriteLine("AutoTest.Server.exe command line arguments");
                Console.WriteLine("");
                Console.WriteLine("To specify watch directory on startup you can type:");
                Console.WriteLine("\tAutoTest.WinForms.exe [WATCH_DIRECTORY] [--local-config-location=/path]");
                return;
            }
            string token = null;

            if (arguments.WatchToken != null)
            {
                var tokenExists = Directory.Exists(arguments.WatchToken) || File.Exists(arguments.WatchToken);
                if (arguments.WatchToken.Contains(".." + Path.DirectorySeparatorChar) || !tokenExists)
                {
                    token = new PathParser(Environment.CurrentDirectory).ToAbsolute(arguments.WatchToken);
                }
                else
                {
                    token = arguments.WatchToken;
                }
            }
            else
            {
                token = Environment.CurrentDirectory;
            }
            Debug.EnableLogging(new ConsoleWriter());
            var watchDirectory = token;

            if (File.Exists(token))
            {
                watchDirectory = Path.GetDirectoryName(token);
            }
            BootStrapper.Configure();
            BootStrapper.Container
            .Register(
                Component.For <IMessageProxy>()
                .Forward <IRunFeedbackView>()
                .Forward <IInformationFeedbackView>()
                .Forward <IConsumerOf <AbortMessage> >()
                .ImplementedBy <MessageProxy>().LifeStyle.Singleton);

            using (var server = new MessageEndpoint(watchDirectory, createHandlers())) {
                var proxy = BootStrapper.Services.Locate <IMessageProxy>();
                proxy.SetMessageForwarder(server);
                BootStrapper.Services.Locate <IRunResultCache>().EnabledDeltas();
                BootStrapper.InitializeCache(token);
                using (var watcher = BootStrapper.Services.Locate <IDirectoryWatcher>())
                {
                    if (arguments.ConfigurationLocation != null)
                    {
                        var configurationLocation = arguments.ConfigurationLocation;
                        if (Directory.Exists(Path.Combine(token, configurationLocation)))
                        {
                            configurationLocation = Path.Combine(token, configurationLocation);
                        }
                        watcher.LocalConfigurationIsLocatedAt(configurationLocation);
                    }
                    watcher.Watch(token, false);
                    Debug.EnableLogging(new ConsoleWriter());

                    while (!exit && server.IsAlive)
                    {
                        Thread.Sleep(100);
                    }
                    Console.WriteLine("exiting");
                }
                Console.WriteLine("shutting down");
                BootStrapper.ShutDown();
                Console.WriteLine("disposing server");
            }
            Console.WriteLine("done");
        }
コード例 #13
0
 public static void AssemblyInit(TestContext context)
 {
     BootStrapper.Configure(); //TODO SACAR ESTO DE ACA LPM
 }
コード例 #14
0
 private void bootStrapAutoTest(string watchDirectory)
 {
     BootStrapper.Configure();
     BootStrapper.InitializeCache(watchDirectory);
 }
コード例 #15
0
        public void Start()
        {
            lock (_padlock)
            {
                Logger.WriteDebug("Starting autotest.net engine");
                BootStrapper.SetBuildConfiguration(
                    new BuildConfiguration((original, @new) => {
                    var detector = new PublicContractChangeDetector();
                    var changes  = detector.GetAllPublicContractChangesBetween(original, @new).ToArray();
                    var optimisticBuildPossible = changes.Length == 0;
                    if (!optimisticBuildPossible)
                    {
                        Debug.WriteDebug("Optimistic build changes");
                        foreach (var change in changes)
                        {
                            Debug.WriteDebug("\t" + change.ItemChanged);
                        }
                    }
                    return(optimisticBuildPossible);
                }));
                BootStrapper.Configure(_writeLocator);
                Logger.WriteDebug("Setting up log writer");
                Logger.SetWriter(BootStrapper.Services.Locate <IWriteDebugInfo>());
                BootStrapper.Container.Register(Component.For <IMessageProxy>()
                                                .Forward <IConsumerOf <AssembliesMinimizedMessage> >()
                                                .Forward <IConsumerOf <AbortMessage> >()
                                                .ImplementedBy <AutoTestMessageProxy>().LifeStyle.Singleton);
                BootStrapper.Container.Register(Component.For <IPreProcessTestruns>().ImplementedBy <MinimizingPreProcessor>().LifeStyle.Singleton);
                BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <MinimizingBuildPreProcessor>());
                BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().Forward <IPreProcessTestruns>().ImplementedBy <OnDemanTestrunPreprocessor>().LifeStyle.Singleton);
                BootStrapper.Container.Register(Component.For <IPreProcessBuildruns>().ImplementedBy <RealtimeChangePreProcessor>().LifeStyle.Singleton);
                BootStrapper.Container.Register(Component.For <IConsumerOf <FileChangeMessage> >().ImplementedBy <RecursiveRunCauseConsumer>().Named("RecursiveRunConsumer"));
                BootStrapper.Container.Register(Component.For <ICustomIgnoreProvider>().ImplementedBy <IgnoreProvider>());
                Logger.WriteDebug("Setting up message proxy");
                _proxy = BootStrapper.Services.Locate <IMessageProxy>();
                _proxy.SetMessageForwarder(_server);
                _proxy.RunStarted  += _proxy_RunStarted;
                _proxy.RunFinished += _proxy_RunFinished;
                _configuration      = BootStrapper.Services.Locate <IConfiguration>();
                if (_configuration.DebuggingEnabled)
                {
                    Logger.EnableWriter();
                }
                Logger.WriteDebug("Checking license");
                if (licenseIsInvalid())
                {
                    return;
                }

                _realtimeChangeTracker = new ChangeTracker(getRealtimeRunPreprocessor(), _configuration, BootStrapper.Services.Locate <IMessageBus>(), BootStrapper.Services.Locate <IGenerateBuildList>());
                Logger.WriteDebug("Setting up cache");
                var runCache = BootStrapper.Services.Locate <IRunResultCache>();
                runCache.EnabledDeltas();
                BootStrapper.InitializeCache(_watchPath);
                _watcher = BootStrapper.Services.Locate <IDirectoryWatcher>();
                _watcher.Watch(_watchPath);
                _configuration.ValidateSettings();
                _configuredCustomOutput = _configuration.CustomOutputPath;
                var disableAll = _configuration.AllSettings("mm-AllDisabled").ToLower().Equals("true");
                StartedPaused = _configuration.StartPaused || disableAll;
                _isPaused     = StartedPaused;
                setCustomOutputPath();
                var minimizer = getMinimizer();
                minimizer.ProfilerCompletedUpdate += minimizer_ProfilerCompletedUpdate;
                minimizer.ProfilerInitialized     += minimizer_ProfilerInitialized;
                minimizer.MinimizerInitialized    += minimizer_MinimizerInitialized;
                minimizer.ProfilingStarted        += (sender, e) => _server.Send(new ProfiledTestRunStarted());
                minimizer.ProfilerLoadError       += profiler_profilercorrupted;
                minimizer.SetManualUpdateProvider(() => _isPaused);
                initializeAllForPreProcessor(minimizer);
                if (disableAll)
                {
                    Pause();
                }
                IsRunning = true;
            }
        }