Beispiel #1
0
            public static void Reset()
            {
                ctorCounter    = 0;
                testCounter    = 0;
                disposeCounter = 0;

                BeforeAfterSpyAttribute.Reset();
            }
Beispiel #2
0
        public void BeforeThrowsAfterThrowsShouldResultInBeforeException()
        {
            MethodInfo         methodInfo = typeof(MultipleAttributeSpy).GetMethod("PassedTest");
            StubTestCommand    stub       = new StubTestCommand();
            BeforeAfterCommand command    = new BeforeAfterCommand(stub, methodInfo);

            BeforeAfterSpyAttribute.Reset();
            BeforeAfterSpyAttribute.beforeTestThrowCount = 2;
            BeforeAfterSpyAttribute.afterTestThrowCount  = 1;

            Assert.Throws <Exception>(() => command.Execute(new MultipleAttributeSpy()));
        }
Beispiel #3
0
        public void TestThrowsAfterThrowsShouldResultInTestException()
        {
            MethodInfo      methodInfo = typeof(MultipleAttributeSpy).GetMethod("PassedTest");
            StubTestCommand stub       = new StubTestCommand {
                ThrowsOnExecute = true
            };
            BeforeAfterCommand command = new BeforeAfterCommand(stub, methodInfo);

            BeforeAfterSpyAttribute.Reset();
            BeforeAfterSpyAttribute.afterTestThrowCount = 1;

            Assert.Throws <Exception>(() => command.Execute(new InstrumentedTestClass()));
        }
Beispiel #4
0
        public void MultipleBeforeTestsSecondThrows()
        {
            MethodInfo         methodInfo = typeof(MultipleAttributeSpy).GetMethod("PassedTest");
            StubTestCommand    stub       = new StubTestCommand();
            BeforeAfterCommand command    = new BeforeAfterCommand(stub, methodInfo);

            BeforeAfterSpyAttribute.Reset();
            BeforeAfterSpyAttribute.beforeTestThrowCount = 2;

            Assert.Throws <Exception>(() => command.Execute(new MultipleAttributeSpy()));

            Assert.Equal(2, BeforeAfterSpyAttribute.beforeTestCount);
            Assert.Equal(0, stub.ExecuteCount);
            Assert.Equal(1, BeforeAfterSpyAttribute.afterTestCount);
        }
Beispiel #5
0
 public new static void Reset()
 {
     FixtureSpy.Reset();
     BeforeAfterSpyAttribute.Reset();
 }