Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testAfter()
        public virtual void TestAfter()
        {
            Result result = JUnitCore.runClasses(typeof(Before3));

            Assert.AreEqual(1, result.FailureCount);
            Assert.IsTrue(result.Failures.Get(0).Trace.Contains("There are overridden methods"));
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testCorrectCodecReported()
        public virtual void TestCorrectCodecReported()
        {
            Result r = JUnitCore.runClasses(typeof(Nested1));

            Assert.AreEqual(1, r.FailureCount);
            Assert.IsTrue(base.SysErr().Contains("codec=" + Nested1.CodecName), base.SysErr());
        }
Пример #3
0
        private string RunAndReturnSyserr()
        {
            JUnitCore.runClasses(typeof(Nested));
            string err = SysErr;

            return(err);
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExceptionWithinBefore()
        public virtual void TestExceptionWithinBefore()
        {
            Result runClasses = JUnitCore.runClasses(typeof(Nested3));

            Assert.AreEqual(1, runClasses.FailureCount);
            Assert.AreEqual(1, runClasses.RunCount);
            Assert.IsTrue(runClasses.Failures.Get(0).Trace.Contains("foobar"));
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testNonStringProperties()
        public virtual void TestNonStringProperties()
        {
            Result runClasses = JUnitCore.runClasses(typeof(NonStringProperties));

            Assert.AreEqual(1, runClasses.FailureCount);
            Assert.IsTrue(runClasses.Failures.Get(0).Message.Contains("Will pass"));
            Assert.AreEqual(3, runClasses.RunCount);
        }
Пример #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRuleInvariantAfterClass()
        public virtual void TestRuleInvariantAfterClass()
        {
            Result runClasses = JUnitCore.runClasses(typeof(InAfterClass));

            Assert.AreEqual(1, runClasses.FailureCount);
            Assert.IsTrue(runClasses.Failures.Get(0).Message.Contains(PROP_KEY1));
            Assert.IsNull(System.getProperty(PROP_KEY1));
        }
Пример #7
0
        /// <summary>
        /// Verify super method calls on <seealso cref="LuceneTestCase#tearDown()"/>.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testTeardownChaining()
        public virtual void TestTeardownChaining()
        {
            Result result = JUnitCore.runClasses(typeof(NestedTeardownChain));

            Assert.AreEqual(1, result.FailureCount);
            Failure failure = result.Failures.Get(0);

            Assert.IsTrue(failure.Message.Contains("One of the overrides of tearDown does not propagate the call."));
        }
Пример #8
0
        private string RunAndReturnSyserr()
        {
            JUnitCore.runClasses(typeof(Nested));

            string err = SysErr;

            // super.prevSysErr.println("Type: " + type + ", point: " + where + " resulted in:\n" + err);
            // super.prevSysErr.println("---");
            return(err);
        }
Пример #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRuleInvariantInTestMethod()
        public virtual void TestRuleInvariantInTestMethod()
        {
            Result runClasses = JUnitCore.runClasses(typeof(InTestMethod));

            Assert.AreEqual(2, runClasses.FailureCount);
            foreach (Failure f in runClasses.Failures)
            {
                Assert.IsTrue(f.Message.Contains(PROP_KEY1));
            }
            Assert.IsNull(System.getProperty(PROP_KEY1));
        }
Пример #10
0
        /// <summary>
        /// Verify super method calls on <seealso cref="LuceneTestCase#setUp()"/>.
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testUncaughtDumpsSeed()
        public virtual void TestUncaughtDumpsSeed()
        {
            Result result = JUnitCore.runClasses(typeof(ThrowInUncaught));

            Assert.AreEqual(1, result.FailureCount);
            Failure f     = result.Failures.Get(0);
            string  trace = f.Trace;

            Assert.IsTrue(trace.Contains("SeedInfo.seed("));
            Assert.IsTrue(trace.Contains("foobar"));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailIfDirectoryNotClosed()
        public virtual void TestFailIfDirectoryNotClosed()
        {
            Result r = JUnitCore.runClasses(typeof(Nested1));

            RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.", r.IgnoreCount == 0);

            foreach (Failure f in r.Failures)
            {
                Console.WriteLine("Failure: " + f);
            }
            Assert.AreEqual(1, r.FailureCount);
            Assert.IsTrue(r.Failures.Get(0).ToString().Contains("Resource in scope SUITE failed to close"));
        }
Пример #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testIgnoredProperty()
        public virtual void TestIgnoredProperty()
        {
            System.clearProperty(PROP_KEY1);
            try
            {
                Result runClasses = JUnitCore.runClasses(typeof(IgnoredProperty));
                Assert.AreEqual(0, runClasses.FailureCount);
                Assert.AreEqual(VALUE1, System.getProperty(PROP_KEY1));
            }
            finally
            {
                System.clearProperty(PROP_KEY1);
            }
        }
Пример #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFailIfUnreferencedFiles()
        public virtual void TestFailIfUnreferencedFilesMem()
        {
            Result r = JUnitCore.runClasses(typeof(Nested1));

            RandomizedTest.assumeTrue("Ignoring nested test, very likely zombie threads present.", r.IgnoreCount == 0);

            // We are suppressing output anyway so dump the failures.
            foreach (Failure f in r.Failures)
            {
                Console.WriteLine(f.Trace);
            }

            Assert.AreEqual(1, r.FailureCount, "Expected exactly one failure.");
            Assert.IsTrue(r.Failures.Get(0).Trace.Contains("unreferenced files:"), "Expected unreferenced files assertion.");
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSetupWithoutLocale()
        public virtual void TestSetupWithoutLocale()
        {
            Result runClasses = JUnitCore.runClasses(typeof(Nested));

            Assert.AreEqual(0, runClasses.FailureCount);

            string s1 = Nested.PickString;

            System.setProperty("tests.seed", Nested.Seed);
            System.setProperty("tests.timezone", Nested.DefaultTimeZone.ID);
            System.setProperty("tests.locale", Nested.DefaultLocale.ToString());
            JUnitCore.runClasses(typeof(Nested));
            string s2 = Nested.PickString;

            Assert.AreEqual(s1, s2);
        }
Пример #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testExceptionWithinTestFailsTheTest()
        public virtual void TestExceptionWithinTestFailsTheTest()
        {
            Result runClasses = JUnitCore.runClasses(typeof(Nested2));

            Assert.AreEqual(3, runClasses.FailureCount);
            Assert.AreEqual(3, runClasses.RunCount);

            List <string> foobars = new List <string>();

            foreach (Failure f in runClasses.Failures)
            {
                Matcher m = Pattern.compile("foobar[0-9]+").matcher(f.Trace);
                while (m.find())
                {
                    foobars.Add(m.group());
                }
            }

            foobars.Sort();
            Assert.AreEqual("[foobar1, foobar2, foobar3]", Arrays.ToString(foobars.ToArray()));
        }
Пример #16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testRuleOrder()
        public virtual void TestRuleOrder()
        {
            JUnitCore.runClasses(typeof(Nested));
            Assert.AreEqual(Arrays.ToString(Stack.ToArray()), "[@Rule before, @Before, @After, @Rule after, @AfterClass]");
        }