public void TryGetInfo_inside_test_method()
        {
            var res = new CallStackReflector().TryGetLocation();

            Assert.IsTrue(res.Filepath.EndsWith("ReflectorTest.cs"));
            Assert.AreEqual(32, res.LineNumber);
        }
        public void TryGetInfo_inside_AssertThrowsLambda_expected_outside_lambda()
        {
            UnitTestLocationInfo res = null;

            Assert.DoesNotThrow(() => res = new CallStackReflector().TryGetLocation());

            Assert.IsTrue(res.Filepath.EndsWith("ReflectorTest.cs"));
            Assert.AreEqual(55, res.LineNumber);
        }
Exemple #3
0
        /// <summary>
        /// Assert that two strings are the same using the configures asserter method. Upon a failure, a suggested string for correcting the test
        /// is printed.
        /// </summary>
        public void AreEqual(string expected, string actual)
        {
            if (expected == actual)
            {
                return;
            }

            var reflector = new CallStackReflector();
            var info      = reflector.TryGetLocation();

            CallUnderlyingAssert(expected, actual, info);
        }