当前位置: 首页>>代码示例>>C#>>正文


C# TestPackage类代码示例

本文整理汇总了C#中TestPackage的典型用法代码示例。如果您正苦于以下问题:C# TestPackage类的具体用法?C# TestPackage怎么用?C# TestPackage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestPackage类属于命名空间,在下文中一共展示了TestPackage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CorrectRunnerIsUsed

 public void CorrectRunnerIsUsed(string files, string domainUsage, Type expectedType)
 {
     var package = new TestPackage(files.Split(new char[] { ' ' }));
     if (domainUsage != null)
         package.Settings["DomainUsage"] = domainUsage;
     Assert.That(_factory.MakeTestRunner(package), Is.TypeOf(expectedType));
 }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:7,代码来源:CoreTestRunnerFactoryTests.cs

示例2: MakeTestRunner

        /// <summary>
        /// Returns a test runner based on the settings in a TestPackage.
        /// Any setting that is "consumed" by the factory is removed, so
        /// that downstream runners using the factory will not repeatedly
        /// create the same type of runner.
        /// </summary>
        /// <param name="package">The TestPackage to be loaded and run</param>
        /// <returns>An ITestEngineRunner</returns>
        public virtual ITestEngineRunner MakeTestRunner(TestPackage package)
        {
            DomainUsage domainUsage = (DomainUsage)System.Enum.Parse(
                typeof(DomainUsage),
                package.GetSetting(EnginePackageSettings.DomainUsage, "Default"));

            switch (domainUsage)
            {
                default:
                case DomainUsage.Default:
                    if (package.SubPackages.Count > 1)
                        return new MultipleTestDomainRunner(this.ServiceContext, package);
                    else
                        return new TestDomainRunner(this.ServiceContext, package);

                case DomainUsage.Multiple:
                    return new MultipleTestDomainRunner(ServiceContext, package);

                case DomainUsage.None:
                    return new LocalTestRunner(ServiceContext, package);

                case DomainUsage.Single:
                    return new TestDomainRunner(ServiceContext, package);
            }
        }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:33,代码来源:InProcessTestRunnerFactory.cs

示例3: GetById_ReturnsProject_WithMatchedId

 public void GetById_ReturnsProject_WithMatchedId()
 {
     var p = new TestPackage();
     var expectedId = p.ProjectSetMock.Object.First().ProjectId;
     var project = p.Tested.Get(expectedId);
     Assert.AreEqual(project.ProjectId, expectedId);
 }
开发者ID:jwoodman510,项目名称:ProjectManagement,代码行数:7,代码来源:ProjectDacTests.cs

示例4: CreateDomain

        /// <summary>
        /// Construct an application domain for running a test package
        /// </summary>
        /// <param name="package">The TestPackage to be run</param>
        public AppDomain CreateDomain( TestPackage package )
        {
            AppDomainSetup setup = CreateAppDomainSetup(package);

            string domainName = "test-domain-" + package.Name;
            // Setup the Evidence
            Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);
            if (evidence.Count == 0)
            {
                Zone zone = new Zone(SecurityZone.MyComputer);
                evidence.AddHost(zone);
                Assembly assembly = Assembly.GetExecutingAssembly();
                Url url = new Url(assembly.CodeBase);
                evidence.AddHost(url);
                Hash hash = new Hash(assembly);
                evidence.AddHost(hash);
            }

            log.Info("Creating AppDomain " + domainName);

            AppDomain runnerDomain = AppDomain.CreateDomain(domainName, evidence, setup);

            // Set PrincipalPolicy for the domain if called for in the settings
            if (_settingsService != null && _settingsService.GetSetting("Options.TestLoader.SetPrincipalPolicy", false))
            {
                runnerDomain.SetPrincipalPolicy(_settingsService.GetSetting(
                    "Options.TestLoader.PrincipalPolicy", 
                    PrincipalPolicy.UnauthenticatedPrincipal));
            }

            return runnerDomain;
        }
开发者ID:alfeg,项目名称:nunit,代码行数:36,代码来源:DomainManager.cs

示例5: NamespaceSetUpFixtureReplacesNamespaceNodeInTree

        public void NamespaceSetUpFixtureReplacesNamespaceNodeInTree()
        {
            string nameSpace = "NUnit.TestData.SetupFixture.Namespace1";
            TestSuiteBuilder builder = new TestSuiteBuilder();
            TestPackage package = new TestPackage( testAssembly );
            package.TestName = nameSpace;
            Test suite= builder.Build( package );

            Assert.IsNotNull(suite);

            Assert.AreEqual(testAssembly, suite.TestName.Name);
            Assert.AreEqual(1, suite.Tests.Count);

            string[] nameSpaceBits = nameSpace.Split('.');
            for (int i = 0; i < nameSpaceBits.Length; i++)
            {
                suite = suite.Tests[0] as TestSuite;
                Assert.AreEqual(nameSpaceBits[i], suite.TestName.Name);
                Assert.AreEqual(1, suite.Tests.Count);
            }

            Assert.IsInstanceOf(typeof(SetUpFixture), suite);

            suite = suite.Tests[0] as TestSuite;
            Assert.AreEqual("SomeTestFixture", suite.TestName.Name);
            Assert.AreEqual(1, suite.Tests.Count);
        }
开发者ID:alexboly,项目名称:CSharpTestExamples,代码行数:27,代码来源:SetUpFixtureTests.cs

示例6: ExpandProjectPackage

        /// <summary>
        /// Expands a TestPackage based on a known project format, populating it
        /// with the project contents and any settings the project provides. 
        /// Note that the package file path must be checked to ensure that it is
        /// a known project format before calling this method.
        /// </summary>
        /// <param name="package">The TestPackage to be expanded</param>
        public void ExpandProjectPackage(TestPackage package)
        {
            Guard.ArgumentNotNull(package, "package");
            Guard.ArgumentValid(package.SubPackages.Count == 0, "Package is already expanded", "package");

            string path = package.FullName;
            if (!File.Exists(path))
                return;

            IProject project = LoadFrom(path);
            Guard.ArgumentValid(project != null, "Unable to load project " + path, "package");

            string configName = package.GetSetting(EnginePackageSettings.ActiveConfig, (string)null); // Need RunnerSetting
            TestPackage tempPackage = project.GetTestPackage(configName);

            // The original package held overrides, so don't change them, but
            // do apply any settings specified within the project itself.
            foreach (string key in tempPackage.Settings.Keys)
                if (!package.Settings.ContainsKey(key)) // Don't override settings from command line
                    package.Settings[key] = tempPackage.Settings[key];

            foreach (var subPackage in tempPackage.SubPackages)
                package.AddSubPackage(subPackage);

            // If no config is specified (by user or by the proejct loader) check
            // to see if one exists in same directory as the package. If so, we
            // use it. If not, each assembly will use it's own config, if present.
            if (!package.Settings.ContainsKey(EnginePackageSettings.ConfigurationFile))
            {
                var packageConfig = Path.ChangeExtension(path, ".config");
                if (File.Exists(packageConfig))
                    package.Settings[EnginePackageSettings.ConfigurationFile] = packageConfig;
            }
        }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:41,代码来源:ProjectService.cs

示例7: LoadPackage

        /// <summary>
        /// Load a TestPackage for possible execution
        /// </summary>
        /// <param name="package">The TestPackage to be loaded</param>
        /// <returns>A TestEngineResult.</returns>
        protected override TestEngineResult LoadPackage()
        {
            List<TestPackage> packages = new List<TestPackage>();

            foreach (string testFile in TestPackage.TestFiles)
            {
                TestPackage subPackage = new TestPackage(testFile);
                if (Services.ProjectService.IsProjectFile(testFile))
                    Services.ProjectService.ExpandProjectPackage(subPackage);
                foreach (string key in TestPackage.Settings.Keys)
                    subPackage.Settings[key] = TestPackage.Settings[key];
                packages.Add(subPackage);
            }

            List<TestEngineResult> results = new List<TestEngineResult>();

            foreach (TestPackage subPackage in packages)
            {
                var runner = CreateRunner(subPackage);
                _runners.Add(runner);
                results.Add(runner.Load());
            }

            return ResultHelper.Merge(results);
        }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:30,代码来源:AggregatingTestRunner.cs

示例8: AbstractTestRunner

 public AbstractTestRunner(IServiceLocator services, TestPackage package)
 {
     Services = services;
     TestPackage = package;
     TestRunnerFactory = Services.GetService<ITestRunnerFactory>();
     ProjectService = Services.GetService<IProjectService>();
 }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:7,代码来源:AbstractTestRunner.cs

示例9: LoadTestFixtureFromAssembly

 public void LoadTestFixtureFromAssembly()
 {
     TestSuiteBuilder builder = new TestSuiteBuilder();
     TestPackage package = new TestPackage( thisDll );
     package.TestName = this.GetType().FullName;
     Test suite= builder.Build( package );
     Assert.IsNotNull(suite, "Should not be Null");
 }
开发者ID:scottwis,项目名称:eddie,代码行数:8,代码来源:AssemblyTests.cs

示例10: Setup

        public void Setup()
        {
            TestSuiteBuilder builder = new TestSuiteBuilder();
            TestPackage package = new TestPackage(AssemblyHelper.GetAssemblyPath(typeof(ActionAttributeExceptionFixture)));
            package.TestName = typeof(ActionAttributeExceptionFixture).Namespace;

            _Suite = builder.Build(package);
        }
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:8,代码来源:ActionAttributeExceptionTests.cs

示例11: ChangePassword_Validates_And_Saves

 public void ChangePassword_Validates_And_Saves()
 {
     var p = new TestPackage();
     p.Tested.ChangePassword(1, "Password", "password123");
     p.PasswordSetMock.Verify(x => x.Attach(It.IsAny<Password>()), Times.Once);
     p.ContextProviderMock.Verify(x => x.SetEntryModified(It.IsAny<Password>()), Times.Once);
     p.ContextProviderMock.Verify(x => x.SaveChanges(), Times.Once);
 }
开发者ID:jwoodman510,项目名称:ProjectManagement,代码行数:8,代码来源:UserDacTests.cs

示例12: calling_Reserve_with_2_queues_should_call_BLPop_with_2_queues

        public void calling_Reserve_with_2_queues_should_call_BLPop_with_2_queues()
        {
            var package = new TestPackage(new[] { "queue1", "queue2" });

            var job = package.UnderTest.Reserve();

            package.RedisMock.Verify(x => x.BLPop(new[] { "queue:queue1", "queue:queue2" }, It.IsAny<int>()));
        }
开发者ID:paulduran,项目名称:Resque.NET,代码行数:8,代码来源:WorkerTests.cs

示例13: calling_Reserve_should_get_a_job

        public void calling_Reserve_should_get_a_job()
        {
            var package = new TestPackage(new[] {""});

            var job = package.UnderTest.Reserve();

            Assert.That(job, Is.Not.Null);
        }
开发者ID:paulduran,项目名称:Resque.NET,代码行数:8,代码来源:WorkerTests.cs

示例14: CreateDomain

        /// <summary>
        /// Creates a new AppDomain for running the test package
        /// </summary>
        /// <param name="package">The test package to be run</param>
        /// <returns></returns>
        public static AppDomain CreateDomain(TestPackage package)
        {
            AppDomainSetup setup = CreateAppDomainSetup(package);

            string domainName = "test-domain-" + package.Name;

            return AppDomain.CreateDomain(domainName, null, setup);
        }
开发者ID:petabridge,项目名称:NBench,代码行数:13,代码来源:DomainManager.cs

示例15: CreateRunner

 // Create a MultipleTestProcessRunner with a fake package consisting of
 // some number of assemblies and with an optional MaxAgents setting.
 // Zero means that MaxAgents is not specified.
 MultipleTestProcessRunner CreateRunner(int assemblyCount, int maxAgents)
 {
     // Currently, we can get away with null entries here
     var package = new TestPackage(new string[assemblyCount]);
     if (maxAgents > 0)
         package.Settings[EnginePackageSettings.MaxAgents] = maxAgents;
     return new MultipleTestProcessRunner(new ServiceContext(), package);
 }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:11,代码来源:MultipleTestProcessRunnerTests.cs


注:本文中的TestPackage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。