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

C# TestMethod类代码示例

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

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



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

示例1: ExecuteMethodThrowsException

 public void ExecuteMethodThrowsException() {
    var fixture = new TestFixture(typeof(Foo));
    var tm = new TestMethod(fixture, typeof(Foo).GetMethod("MethodWithException"));
    tm.Execute(_listener);
    Assert.Equals(" MethodWithException", _sequence);
    Assert.StartsWith(" TS:MethodWithException TE:MethodWithException ", SimpleTestListener.Messages);
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:7,代码来源:TestMethodTests.cs


示例2: TestRepository

        public TestRepository(ILdapManager ldapManagerObj, TestUserRepository testUserRepository)
        {
            _testImplementation = new TestImplementation.TestImplementation(testUserRepository, ldapManagerObj);

            TestList = new Dictionary<TestType, TestMethod>
            {
                {TestType.TestAdminConnection, _testImplementation.TestAdminConnect},
                {TestType.TestCreateUser, _testImplementation.TestCreateUser},
                {TestType.TestDeleteUser, _testImplementation.TestDeleteUser},
                {TestType.TestInitLibrary, _testImplementation.TestCompleteInitLibrary},
                {TestType.TestInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin},
                {TestType.TestModifyUserDescription, _testImplementation.TestModifyUserAttribute},
                {TestType.TestSearchUsers, _testImplementation.TestSearchUser},
                {TestType.TestStandardInitLibraryNoAdmin, _testImplementation.TestStardardInitLibraryNoAdmin},
                {TestType.TestUserChangePassword, _testImplementation.TestChangeUserPassword},
                {
                    TestType.TestConnectUser, () =>
                    {
                        var testMethod = new TestMethod(_testImplementation.TestUserConnectWithoutWritePermissions);
                        if (_writePermission) testMethod = _testImplementation.TestUserConnect;
                        return testMethod();
                    }
                },
                {
                    TestType.TestSearchUserAndConnect, () =>
                    {
                        var testMethod =
                            new TestMethod(_testImplementation.TestSearchUserAndConnectWithoutWritePermissions);
                        if (_writePermission) testMethod = _testImplementation.TestSearchUserAndConnect;
                        return testMethod();
                    }
                }
            };
        }
开发者ID:tu226,项目名称:LDAP-Library,代码行数:34,代码来源:TestRepository.cs


示例3: ShouldNotIgnoreMethodNotMarkedIgnore

        public void ShouldNotIgnoreMethodNotMarkedIgnore()
        {
            MethodInfo methodInfo = typeof(TestMethodTest).GetMethod("MethodNotMarkedIgnore");
            var testMethod = new TestMethod(methodInfo);

            Assert.IsFalse(testMethod.Ignore);
        }
开发者ID:garyjohnson,项目名称:vitaUnit,代码行数:7,代码来源:TestMethodTest.cs


示例4: MSTestAutomation

 /// <summary>
 /// Initializes a new <see cref="MSTestAutomation"/>.
 /// </summary>
 public MSTestAutomation(TestMethod testMethod)
 {
     Name = String.Format("{0}.{1}", testMethod.FullClassName, testMethod.Name);
     Identifier = _identifierFactory.CreateIdentifier(Name);
     Storage = Path.GetFileName(testMethod.AssemblyName);
     TestType = "Unit Test";
 }
开发者ID:testpulse,项目名称:TFSTestCaseAutomator,代码行数:10,代码来源:MSTestAutomation.cs


示例5: MakeTestCommand

        /// <summary>
        /// Creates a test command for use in running this test.
        /// </summary>
        /// <returns></returns>
        public static TestCommand MakeTestCommand(TestMethod test)
        {
            // Command to execute test
            TestCommand command = new TestMethodCommand(test);

            // Add any wrappers to the TestMethodCommand
            foreach (IWrapTestMethod wrapper in test.Method.GetCustomAttributes(typeof(IWrapTestMethod), true))
                command = wrapper.Wrap(command);

            // Wrap in TestActionCommand
            command = new TestActionCommand(command);

            // Wrap in SetUpTearDownCommand
            command = new SetUpTearDownCommand(command);

            // Add wrappers that apply before setup and after teardown
            foreach (ICommandWrapper decorator in test.Method.GetCustomAttributes(typeof(IWrapSetUpTearDown), true))
                command = decorator.Wrap(command);

            // Add command to set up context using attributes that implement IApplyToContext
            IApplyToContext[] changes = (IApplyToContext[])test.Method.GetCustomAttributes(typeof(IApplyToContext), true);
            if (changes.Length > 0)
                command = new ApplyChangesToContextCommand(command, changes);

            return command;
        }
开发者ID:jlewicki,项目名称:nunit,代码行数:30,代码来源:CommandBuilder.cs


示例6: ExecuteMethod

 public void ExecuteMethod() {
    var fixture = new TestFixture(typeof(Foo));
    var tm = new TestMethod(fixture, typeof(Foo).GetMethod("AMethod"));
    tm.Execute( _listener);
    Assert.Equals(" AMethod", _sequence);
    Assert.Equals(" TS:AMethod TP:AMethod", SimpleTestListener.Messages);
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:7,代码来源:TestMethodTests.cs


示例7: DoTimedRun

        public static void DoTimedRun(TestMethod testMethod, int reps)
        {
            System.GC.Collect();

            long rigging_time = 0;
            long start;
            long finish;

            //			start = System.DateTime.Now.Ticks;
            //			for (int i = 1; i <= reps; i++)
            //			{
            //				new TestMethod(DoNothingTestMethod)();
            //			}
            //			finish = System.DateTime.Now.Ticks;
            //			rigging_time = (finish - start);

            Console.Out.Write("TIME: {0}", testMethod.Method.Name);
            start = System.DateTime.Now.Ticks;
            for (int i = 1; i <= reps; i++)
            {
                testMethod();
            }
            finish = System.DateTime.Now.Ticks;
            long millis = ((finish - start) - rigging_time) / TimeSpan.TicksPerMillisecond;

            Console.Out.WriteLine("; repeats = {0} {1}ms ({2} millisec/eval)", reps, millis, (millis/reps));
        }
开发者ID:david-mcneil,项目名称:stringtemplate,代码行数:27,代码来源:TestUtils.cs


示例8: SetUp

        public void SetUp()
        {
            _test = new TestMethod(new MethodWrapper(typeof(DummySuite), "DummyMethod"));
            _testResult = _test.MakeTestResult();

            _suite = new TestSuite(typeof(DummySuite));
            _suiteResult = (TestSuiteResult)_suite.MakeTestResult();
        }
开发者ID:nunit,项目名称:nunit,代码行数:8,代码来源:TestResultTests.cs


示例9: OneNameCriterion

 public void OneNameCriterion() {
    ITestMethod tm =
       new TestMethod(new TestFixture(typeof(SampleTestFixture)),
                      typeof(SampleTestFixture).GetMethod("Foo"));
    var nameCriterion = new NameCriterion(typeof(SampleTestFixture).FullName + ".Foo");
    var selection = new TestRun(nameCriterion);
    Assert.True(selection.Contains(tm));
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:CriteriaTests.cs


示例10: SetsTestClassOnTestMethods

        public void SetsTestClassOnTestMethods()
        {
            TestMethod testMethod = new TestMethod(null, null, null);

            var testClass = new TestClass("typeName", new[] { testMethod });

            Assert.Same(testClass, testMethod.TestClass);
        }
开发者ID:nulltoken,项目名称:xunit,代码行数:8,代码来源:TestClassTests.cs


示例11: Main

 static void Main(string[] args)
 {
     Program program = new Program();
     TestMethod testMethod = new TestMethod(program.SearchShopbyFood);
     //program.OptimisticConcurrencyTest();
     testMethod += program.SearchShopbyFood3;
     testMethod();
 }
开发者ID:rrrttc,项目名称:EntityFramework,代码行数:8,代码来源:Program.cs


示例12: DoTest

 public void DoTest(IWin32Window owner, TestMethod method, object data)
 {
     _alarming = true;
     _method = method;
     _data = data;
     MakePrompt();
     ShowDialog(owner);
 }
开发者ID:zildjohn01,项目名称:Polyriser,代码行数:8,代码来源:TestForm.cs


示例13: TestSkipped

 protected override void TestSkipped(TestMethod method, TestSkippedResult result)
 {
     Console.WriteLine(
         "##teamcity[testIgnored name='{0}' message='{1}']",
         Escape(method.DisplayName),
         Escape(result.Reason)
     );
 }
开发者ID:paulecoyote,项目名称:xunit,代码行数:8,代码来源:TeamCityRunnerCallback.cs


示例14: OneTestConfigured

 public void OneTestConfigured() {
    var testSpec = new TestSpec();
    var testMethod1 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Bar"));
    var testMethod2 = new TestMethod(new TestFixture(typeof(Foo)), typeof(Foo).GetMethod("Nope"));
    testSpec.AddTest(testMethod1);
    Assert.True(testSpec.Contains(testMethod1));
    Assert.False(testSpec.Contains(testMethod2));
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:8,代码来源:TestSpecTests.cs


示例15: RunTest

 public static void RunTest(TestMethod r)
 {
     try
     {
         r();
     }
     catch (TestFailedException) { }
 }
开发者ID:asikaria,项目名称:ConcurrentLockFreeCircularBuffer,代码行数:8,代码来源:BasicTests.cs


示例16: MethodWithAllPassingResultsIsInPassedRunState

    public void MethodWithAllPassingResultsIsInPassedRunState()
    {
        TestMethod method = new TestMethod("methdName", "displayname", null);

        method.RunResults.Add(new TestPassedResult(0.0, "displayname", null));
        method.RunResults.Add(new TestPassedResult(1.2, "displayname", null));

        Assert.Equal(TestStatus.Passed, method.RunStatus);
    }
开发者ID:chrisortman,项目名称:coulda,代码行数:9,代码来源:TestMethodTests.cs


示例17: CreateWorkItems

        public void CreateWorkItems()
        {
            IMethodInfo method = new MethodWrapper(typeof(DummyFixture), "DummyTest");
            ITest test = new TestMethod(method);
            _workItem = WorkItem.CreateWorkItem(test, TestFilter.Empty);

            _context = new TestExecutionContext();
            _workItem.InitializeContext(_context);
        }
开发者ID:jhamm,项目名称:nunit,代码行数:9,代码来源:WorkItemTests.cs


示例18: TestStart

        public override bool TestStart(TestMethod method)
        {
            Console.WriteLine(
                "##teamcity[testStarted name='{0}']",
                Escape(method.DisplayName)
            );

            return true;
        }
开发者ID:paulecoyote,项目名称:xunit,代码行数:9,代码来源:TeamCityRunnerCallback.cs


示例19: DoNap

 public void DoNap(IWin32Window owner, TimeSpan length, TimeSpan cooldown,
     TestMethod testMethod, object testData)
 {
     _testMethod = testMethod;
     _testData = testData;
     _engine.BeginNap(length, cooldown);
     ShowDialog(owner);
     PseudoDispose();
 }
开发者ID:zildjohn01,项目名称:Polyriser,代码行数:9,代码来源:NappingForm.cs


示例20: EmptyFiltersListAlwaysPasses

        public void EmptyFiltersListAlwaysPasses()
        {
            var filters = new XunitFilters();
            var method = new TestMethod("method1", "Display Name 1", traits: null);

            bool result = filters.Filter(method);

            Assert.True(result);
        }
开发者ID:paulecoyote,项目名称:xunit,代码行数:9,代码来源:XunitFiltersTests.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TestModel类代码示例发布时间:2022-05-24
下一篇:
C# TestMessage类代码示例发布时间: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