Beispiel #1
0
 public WebDriverTestMethod(NUnitTestMethod method, bool needsNewDriverBeforeTest, bool needsNewDriverAfterTest)
     : base(method.Method)
 {
     this.needsDriverBefore = needsNewDriverBeforeTest;
     this.needsDriverAfter = needsNewDriverAfterTest;
     this.ExceptionProcessor = method.ExceptionProcessor;
 }
        public void GivenATestWhenWriteDescription()
        {
            _givenMethodName = "GivenMethod1";
            var givenMethods = new[]
                                       {
                                           new NUnitTestMethod(typeof (BDDTestFixtureTestClass).GetMethod(_givenMethodName))
                                       };
            _whenMethodName = "WhenMethod1";
            var whenMethods = new[]
                                      {
                                          new NUnitTestMethod(typeof (BDDTestFixtureTestClass).GetMethod(_whenMethodName))
                                      };
            _mockTypeManager = new Mock<ITypeManager>();
            _mockTypeManager
                .Setup(tm => tm.GetNUnitTestMethodsWithAttribute(It.IsAny<Type>(), typeof(GivenAttribute)))
                .Returns(givenMethods);
            _mockTypeManager
                .Setup(tm => tm.GetNUnitTestMethodsWithAttribute(It.IsAny<Type>(), typeof(WhenAttribute)))
                .Returns(whenMethods);

            _mockTestDescriptionWriter = new Mock<ITestDescriptionWriter>();
            _testMethodName = "TestMethod1";
            var nUnitTestMethod = new NUnitTestMethod(typeof (BDDTestFixtureTestClass).GetMethod(_testMethodName));

            var testDescriber = new TestDescriber(_mockTestDescriptionWriter.Object, _mockTypeManager.Object);
            testDescriber.WriteDescription(nUnitTestMethod);
        }
 public void SetUp()
 {
     MethodInfo fakeTestMethod1 = GetType()
         .GetMethod("FakeTestMethod1", BindingFlags.Instance | BindingFlags.NonPublic);
     fakeTest1 = new NUnitTestMethod(fakeTestMethod1);
     MethodInfo fakeTestMethod2 = GetType()
         .GetMethod("FakeTestMethod2", BindingFlags.Instance | BindingFlags.NonPublic);
     fakeTest2 = new NUnitTestMethod(fakeTestMethod2);
 }
Beispiel #4
0
        public WebDriverTestMethod(NUnitTestMethod method, bool needsNewDriverBeforeTest, bool needsNewDriverAfterTest)
            : base(method.Method)
        {
            this.needsDriverBefore = needsNewDriverBeforeTest;
            this.needsDriverAfter = needsNewDriverAfterTest;

            this.ExceptionExpected = method.ExceptionExpected;
            this.ExceptionHandler = method.ExceptionHandler;
            this.ExpectedExceptionName = method.ExpectedExceptionName;
            this.ExpectedExceptionType = method.ExpectedExceptionType;
            this.ExpectedMessage = method.ExpectedMessage;
        }
        public void SetUp()
        {
            MethodInfo fakeTestMethod = GetType().GetMethod("FakeTestCase", BindingFlags.Instance | BindingFlags.NonPublic);
            var nunitTest = new NUnitTestMethod(fakeTestMethod);
            nunitTest.Categories.Add("cat1");
            nunitTest.Properties.Add("Priority", "medium");

            var nunitFixture = new TestSuite("FakeNUnitFixture");
            nunitFixture.Categories.Add("super");
            nunitFixture.Add(nunitTest);

            Assert.That(nunitTest.Parent, Is.SameAs(nunitFixture));

            var fixtureNode = new TestNode(nunitFixture);
            fakeNUnitTest = (ITest)fixtureNode.Tests[0];

            testConverter = new TestConverter(new TestLogger(), ThisAssemblyPath);
        }
		/// <summary>
		/// Initializes an instance of this class.
		/// </summary>
		/// <param name="fixtureType">The type of the test fixture</param>
		/// <param name="argument">The argument to pass to the Test Fixture Set Up method</param>
		public MultiTestFixture(Type fixtureType, string argument)
			: base(fixtureType)
		{
			this.Fixture = Reflect.Construct(fixtureType);
			ModifyTestName(this.TestName, argument);
			this.Argument = argument;

			this.fixtureTearDownMethods = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.FixtureTearDownAttribute, true);
			this.setUpMethods = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.SetUpAttribute, true);
			this.tearDownMethods = Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TearDownAttribute, true);

			foreach (MethodInfo method in Reflect.GetMethodsWithAttribute(fixtureType, NUnitFramework.TestAttribute, true))
			{
				NUnitTestMethod methodTest = new NUnitTestMethod(method);
				ModifyTestName(methodTest.TestName, argument);
				this.Add(methodTest);
			}
		}
 public TestMethodWrapper(NUnitTestMethod testMethod) 
     : base(testMethod.Method)
 {   
 }
 public Test BuildFrom(MethodInfo method)
 {
     var nUnitTestMethod = new NUnitTestMethod(method) {Description = "Then Test Method"};
     _testDescriber.WriteDescription(nUnitTestMethod);
     return nUnitTestMethod;
 }