public void ShouldExecuteAction()
    {
      TestApplication application = new TestApplication();

      object result = application.ExecuteAction(new Func<string, string>(Action), "parameter");

      Assert.Equal("Parameter: parameter", result);
    }
    public void ShouldCreateObject()
    {
      TestApplication application = new TestApplication();

      object result = application.CreateObject(typeof(KeyValuePair<int, int>), 1, 2);

      Assert.Equal(new KeyValuePair<int, int>(1, 2), result);
    }
Exemple #3
0
        /// <summary>
        /// Stops the application by it's application host definition.
        /// </summary>
        /// <param name="application">The test application.</param>
        public virtual void StopApplication(TestApplication application)
        {
            if (application == null)
            {
                throw new ArgumentNullException("application");
            }

            this.ApplicationManager.ShutdownApplication(application.Id);
        }
    /// <summary>
    /// Initializes a new instance of the <see cref="LiveTestTest"/> class.
    /// </summary>
    public LiveTestTest()
    {
      this.testApplication = Substitute.For<TestApplication>();
      this.initializationManager = Substitute.For<InitializationManager>(Substitute.For<InitializationActionDiscoverer>(), Substitute.For<InitializationActionExecutor>());

      LiveTestBase.TestApplicationManager.StartApplication(Arg.Is<TestApplicationHost>(host => (host.ApplicationId == "Sitecore.LiveTesting.Default") && (host.VirtualPath == "/") && (host.PhysicalPath == "..\\Website"))).Returns(this.testApplication);

      this.realTest = new TestWithCustomInstantiation(this.initializationManager);
    }
    /// <summary>
    /// Initializes a new instance of the <see cref="TestApplicationInitializationContext"/> class.
    /// </summary>
    /// <param name="application">The application.</param>
    public TestApplicationInitializationContext(TestApplication application)
    {
      if (application == null)
      {
        throw new ArgumentNullException("application");
      }

      this.application = application;
    }
Exemple #6
0
        /// <summary>
        /// Gets the list of running applications.
        /// </summary>
        /// <returns>The list of running applications.</returns>
        public virtual IEnumerable <TestApplication> GetRunningApplications()
        {
            List <TestApplication> result = new List <TestApplication>();

            foreach (ApplicationInfo application in this.ApplicationManager.GetRunningApplications())
            {
                TestApplication candidate = this.ApplicationManager.GetObject(application.ID, this.TestApplicationType) as TestApplication;

                if (candidate != null)
                {
                    result.Add(candidate);
                }
            }

            return(result);
        }
    /// <summary>
    /// Stops the application by it's application host definition.
    /// </summary>
    /// <param name="application">The test application.</param>
    public virtual void StopApplication(TestApplication application)
    {
      if (application == null)
      {
        throw new ArgumentNullException("application");
      }

      this.ApplicationManager.ShutdownApplication(application.Id);
    }