Ejemplo n.º 1
0
            protected override void Arrange()
            {
                _options = new DeployDatabase
                {
                    Engine           = EngineType.PostgreSql,
                    DatabaseType     = DatabaseType.ODS,
                    ConnectionString = "Valid Connection String"
                };

                _databaseCommand = Stub <IDatabaseCommand>();

                A.CallTo(() => _databaseCommand.Execute(A <IOptions> ._))
                .Throws(new Exception());

                _databaseCommandFactory = Stub <IDatabaseCommandFactory>();

                A.CallTo(() => _databaseCommandFactory.CreateDatabaseCommands(A <EngineType> ._))
                .Returns(new List <IDatabaseCommand> {
                    _databaseCommand
                });

                _compositeSpecification = Stub <ICompositeSpecification>();

                A.CallTo(() => _compositeSpecification.IsSatisfiedBy(A <object> ._))
                .Returns(true);

                var compositeSpecifications = new List <ICompositeSpecification> {
                    _compositeSpecification
                };

                _result = -99;

                _sut = new ApplicationRunner(_options, _databaseCommandFactory, compositeSpecifications);
            }
 public void Then_last_updated_label_should_be_empty()
 {
     using (var appRunner = new ApplicationRunner())
     {
         var label = appRunner.GetControl <Label>("uiaLastUpdated");
         Assert.AreEqual(string.Empty, label.Text);
     }
 }
Ejemplo n.º 3
0
        public void Initialize()
        {
            m_Application = new ApplicationRunner();
            m_FakeServer = new FakeMediaServer();
            m_PlayListBuilder = new PlayListBuilder();

            m_FakeServer.Reset();
        }
Ejemplo n.º 4
0
 public void Then_last_updated_label_should_be_empty()
 {
     using (var appRunner = new ApplicationRunner())
     {
         var label = appRunner.GetControl<Label>("uiaLastUpdated");
         Assert.AreEqual(string.Empty, label.Text);
     }
 }
Ejemplo n.º 5
0
        public void ShouldParseArguments()
        {
            var subject = new ApplicationRunner();

            subject.Execute("-pfoo.exe", "-d10", "-ablah");

            Assert.That(subject.Options.Path, Is.EqualTo("foo.exe"));
            Assert.That(subject.Options.Arguments, Is.EqualTo("blah"));
            Assert.That(subject.Options.Delay, Is.EqualTo(10));
        }
Ejemplo n.º 6
0
        public void ShouldInitializeOptions()
        {
            var subject = new ApplicationRunner();

            subject.Execute("bad args");

            Assert.IsNull(subject.Options.Path);
            Assert.IsNull(subject.Options.Arguments);
            Assert.That(subject.Options.Delay, Is.EqualTo(0));
        }
Ejemplo n.º 7
0
        public void Then_last_updated_label_should_be_updated()
        {
            using (var appRunner = new ApplicationRunner())
            {
                var button = appRunner.GetControl <Button>("uiaUpdateButton");
                button.RaiseClickEvent();

                var label = appRunner.GetControl <Label>("uiaLastUpdated");
                Assert.That(() => label.Text, Is.Not.EqualTo(string.Empty).After(15000, 100));
            }
        }
        public void Then_last_updated_label_should_be_updated()
        {
            using (var appRunner = new ApplicationRunner())
            {
                var button = appRunner.GetControl<Button>("uiaUpdateButton");
                button.RaiseClickEvent();

                var label = appRunner.GetControl<Label>("uiaLastUpdated");
                Assert.That(() => label.Text, Is.Not.EqualTo(string.Empty).After(15000, 100));
            }
        }
Ejemplo n.º 9
0
        public void TestInitialize()
        {
            _mockApplication     = new Mock <IApplication>(MockBehavior.Strict);
            _mockWindow          = new Mock <IWindow>(MockBehavior.Strict);
            _mockEventDispatcher = new Mock <IEventDispatcher>(MockBehavior.Strict);
            _mockLayerContainer  = new Mock <ILayerContainer>(MockBehavior.Strict);
            _mockRenderContext   = new Mock <IRenderContext>(MockBehavior.Strict);
            _settings            = new Settings();

            _target = new ApplicationRunner(_mockApplication.Object, _mockWindow.Object, _mockEventDispatcher.Object,
                                            _mockLayerContainer.Object, _mockRenderContext.Object, _settings);
        }
Ejemplo n.º 10
0
        public void ShouldLogErrorIfApplicationDoesNotExist()
        {
            var subject = new ApplicationRunner();
            var mockLog = new Mock <ILog>();

            subject.Log = mockLog.Object;
            var path = "/foo/bar.exe";

            mockLog.Setup(x => x.Error(It.IsAny <string>()));
            var message = String.Format("Cannot run {0}. It either does not exist or is inaccessible. Exiting...", path);;

            subject.Execute("-p" + path);

            mockLog.Verify(x => x.Error(It.Is <string>(y => y == message)), Times.Once);
        }
Ejemplo n.º 11
0
        public void ShouldLaunchProcessAndLogOutput()
        {
            var isRunningOnMono = Type.GetType("Mono.Runtime") != null;
            var subject         = new ApplicationRunner();
            var mockLog         = new Mock <ILog>();

            subject.Log = mockLog.Object;
            mockLog.Setup(x => x.Info(It.IsAny <string>()));
            var path      = isRunningOnMono ? "/bin/ls" : @"C:\Windows\System32\cscript.exe";
            var arguments = isRunningOnMono ? "-l" : @"foo.vbs";
            var expected  = isRunningOnMono ? "DeadRinger.Test.dll" : "Windows Script Host";

            subject.Execute("-p" + path, "-a" + arguments);

            mockLog.Verify(x => x.Info(It.Is <string>(y => y.Contains(expected))), Times.Once);
        }
Ejemplo n.º 12
0
            protected override void Arrange()
            {
                _options = new WhatIfExecution
                {
                    Engine           = EngineType.SqlServer,
                    DatabaseType     = DatabaseType.ODS,
                    ConnectionString = "Valid Connection String",
                    Features         = new List <string>
                    {
                        "Changes",
                        "Sample"
                    }
                };

                _databaseCommand = Stub <IDatabaseCommand>();

                _databaseCommandFactory = Stub <IDatabaseCommandFactory>();

                A.CallTo(() => _databaseCommandFactory.CreateDatabaseCommands(A <EngineType> ._))
                .Returns(new List <IDatabaseCommand> {
                    _databaseCommand
                });

                _compositeSpecification = Stub <ICompositeSpecification>();

                A.CallTo(() => _compositeSpecification.IsSatisfiedBy(A <object> ._))
                .Returns(true);

                A.CallTo(() => _databaseCommand.Execute(A <IOptions> ._))
                .Returns(
                    new DatabaseCommandResult
                {
                    IsSuccessful    = true,
                    RequiresUpgrade = false
                });

                var compositeSpecifications = new List <ICompositeSpecification> {
                    _compositeSpecification
                };

                _result = -99;

                _sut = new ApplicationRunner(_options, _databaseCommandFactory, compositeSpecifications);
            }
Ejemplo n.º 13
0
 public void Init()
 {
     _auction     = new FakeAuctionServer("item-54321");
     _application = new ApplicationRunner();
 }
Ejemplo n.º 14
0
 private static int Main() => ApplicationRunner.RunWin32(new CubeApp());
 public void BeforeTest()
 {
     application = new ApplicationRunner(AUCTION_SNIPER_EXE);
 }
Ejemplo n.º 16
0
 protected abstract T createPage(ApplicationRunner app);
Ejemplo n.º 17
0
 static void Main()
 {
     ApplicationRunner.Run();
 }
Ejemplo n.º 18
0
 protected override HomePage createPage(ApplicationRunner app)
 {
     return(new HomePage(app.Driver));
 }
Ejemplo n.º 19
0
 protected override KeywordsPage createPage(ApplicationRunner app)
 {
     return(new KeywordsPage(app.Driver));
 }
Ejemplo n.º 20
0
        private static int Main(string[] args)
        {
            var application = new ExecuteIndirectApp();

            return(ApplicationRunner.RunWin32(application));
        }
Ejemplo n.º 21
0
 public ShutdownCommand(ApplicationRunner applicationRunner)
     : base("shutdown")
 {
     ApplicationRunner = applicationRunner;
 }
 public void OpenPageInBrowser()
 {
     _pageRunner = ApplicationRunner.CreateRetailCalculatorPageRunner();
     _pageRunner.OpenRetailCalculatorPage();
 }
Ejemplo n.º 23
0
 public void OpenAppInBrowser()
 {
     ApplicationRunner.StartBrowser();
 }
Ejemplo n.º 24
0
        private static void Main(params string[] args)
        {
            var isFabric = args.Length > 0 && args[0].Equals("Fabric", StringComparison.InvariantCultureIgnoreCase);

            ApplicationRunner <Application.SampleService> .Run(isFabric);
        }
Ejemplo n.º 25
0
 public void Setup()
 {
     ApplicationRunner = new ApplicationRunnerImpl();
 }
 public void OpenPageInBrowser()
 {
     _pageRunner = ApplicationRunner.CreateStateTaxPageRunner();
     _pageRunner.OpenStateTaxesPage();
 }
Ejemplo n.º 27
0
 public void OpenPageInBrowser()
 {
     _runner = ApplicationRunner.CreateAppMenuRunner();
     _runner.OpenDefaultPage();
 }
Ejemplo n.º 28
0
 private static void Main()
 {
     ApplicationRunner <Application.SampleService> .Run();
 }
Ejemplo n.º 29
0
 public ApplicationImpl(ApplicationRunner applicationRunner, CommandExecutor commandExecutor)
 {
     ApplicationRunner = applicationRunner;
     CommandExecutor   = commandExecutor;
 }
Ejemplo n.º 30
0
        internal void RunApplication(ApplicationRunner runner)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DocObjHostRunApplicationStart);

            // Run the App in the new AppDomain and ask the AppDomainManager
            // to save it.
            PresentationAppDomainManager.SaveAppDomain = true;

            EnableErrorPage();

            if (runner())
            {
                Invariant.Assert(PresentationAppDomainManager.NewAppDomain != null, "Failed to start the application in a new AppDomain");

                Invariant.Assert(ApplicationProxyInternal.Current != null, "Unexpected reentrant PostShutdown?");

                // Create an ApplicationProxyInternal in the new domain.
                PresentationAppDomainManager appDomainMgrProxy =
                            PresentationAppDomainManager.NewAppDomain.DomainManager as PresentationAppDomainManager;

                // And replace _appProxyInternal.
                Invariant.Assert(ApplicationProxyInternal.Current == _appProxyInternal,
                    "AppProxyInternal has shut down unexpectedly.");
                _appProxyInternal = appDomainMgrProxy.CreateApplicationProxyInternal();

                PresentationAppDomainManager.SaveAppDomain = false;

                // Run the app.
                ApplicationProxyInternal.InitData initData = _initData.Value;
                initData.HandleHistoryLoad = true;
                _appProxyInternal.Run(initData);
                _initData.Value = null; // free objects
            }
            else
            {
                // Cached application activation failed
                // we will give the app launcher a chance to retry with Uri activation
                PresentationAppDomainManager.SaveAppDomain = false;
            }

            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DocObjHostRunApplicationEnd);
        }
Ejemplo n.º 31
0
        internal void RunApplication(ApplicationRunner runner)
        {
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DocObjHostRunApplicationStart);
 
            // Run the App in the new AppDomain and ask the AppDomainManager
            // to save it. 
            PresentationAppDomainManager.SaveAppDomain = true; 

            EnableErrorPage(); 

            runner();
            Invariant.Assert(PresentationAppDomainManager.NewAppDomain != null);
 
            if (ApplicationProxyInternal.Current == null)
            { 
                Debug.Fail("Unexpected reentrant PostShutdown?"); 
                return;
            } 

            // Create an ApplicationProxyInternal in the new domain.
            PresentationAppDomainManager appDomainMgrProxy =
                        PresentationAppDomainManager.NewAppDomain.DomainManager as PresentationAppDomainManager; 

            // And replace _appProxyInternal. 
            Invariant.Assert(ApplicationProxyInternal.Current == _appProxyInternal, 
                "AppProxyInternal has shut down unexpectedly.");
            _appProxyInternal = appDomainMgrProxy.CreateApplicationProxyInternal(); 

            PresentationAppDomainManager.SaveAppDomain = false;

            // Run the app. 
            ApplicationProxyInternal.InitData initData = _initData.Value;
            initData.HandleHistoryLoad = true; 
            _appProxyInternal.Run(initData); 
            _initData.Value = null; // free objects
 
            EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordHosting | EventTrace.Keyword.KeywordPerf, EventTrace.Level.Verbose, EventTrace.Event.WpfHost_DocObjHostRunApplicationEnd);
        }
Ejemplo n.º 32
0
 public void CloseBrowser()
 {
     ApplicationRunner.CloseBrowser();
 }
Ejemplo n.º 33
0
 public static void AssemblyInit(TestContext context)
 {
     app = new ApplicationRunner();
 }
Ejemplo n.º 34
0
 private static void Main(params string[] args)
 {
     ApplicationRunner <Application.SampleService> .Run();
 }