• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TestPackage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: runTests

        private TestResult runTests(string nameSpace, TestFilter filter)
        {
            TestSuiteBuilder builder = new TestSuiteBuilder();
			TestPackage package = new TestPackage( testAssembly );
			package.TestName = nameSpace;
            Test suite = builder.Build( package );
            return suite.Run(new NullListener(),filter);
        }
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:8,代码来源:SetUpFixtureTests.cs


示例17: LoadFixture

		[SetUp] public void LoadFixture()
		{
			string testsDll = "test-assembly.dll";
			TestSuiteBuilder builder = new TestSuiteBuilder();
			TestPackage package = new TestPackage( testsDll );
			package.TestName = "NUnit.TestData.TestFixtureExtension.DerivedTestFixture";
			suite= builder.Build( package );
		}
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:8,代码来源:TestFixtureExtension.cs


示例18: LoadFixture

		[SetUp] public void LoadFixture()
		{
            string testsDll = AssemblyHelper.GetAssemblyPath(typeof(DerivedTestFixture));
			TestSuiteBuilder builder = new TestSuiteBuilder();
			TestPackage package = new TestPackage( testsDll );
			package.TestName = typeof(DerivedTestFixture).FullName;
			suite= builder.Build( package );
		}
开发者ID:Buildstarted,项目名称:ContinuousTests,代码行数:8,代码来源:TestFixtureExtension.cs


示例19: AbstractTestRunner

        public AbstractTestRunner(ServiceContext services, TestPackage package)
        {
            this.Services = services;
            this.TestPackage = package;
            TestRunnerFactory = Services.GetService<ITestRunnerFactory>();
#if NUNIT_ENGINE
            ProjectService = Services.GetService<IProjectService>();
#endif
        }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:9,代码来源:AbstractTestRunner.cs


示例20: Create_AddsProject_And_SavesContext

 public void Create_AddsProject_And_SavesContext()
 {
     var p = new TestPackage();
     var user = p.ContextProviderMock.Object.Users.First();
     var newProject = p.Tested.Create(new Project {Title = "new project", UserId = user.UserId});
     Assert.Greater(newProject.ProjectId, 0);
     p.ProjectSetMock.Verify(x => x.Add(It.IsAny<Project>()), Times.Once());
     p.ContextProviderMock.Verify(x => x.SaveChanges(), Times.Once);
 }
开发者ID:jwoodman510,项目名称:ProjectManagement,代码行数:9,代码来源:ProjectDacTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TestParameters类代码示例发布时间:2022-05-24
下一篇:
C# TestOutcome类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap