Пример #1
0
        public static void MainOld(
            string[] args)
        {
            Dstu7624Test test   = new Dstu7624Test();
            ITestResult  result = test.Perform();

            Console.WriteLine(result.ToString());
        }
Пример #2
0
        internal static void RunTest(
            ITest test,
            TextWriter outStream)
        {
            ITestResult result = test.Perform();

            outStream.WriteLine(result.ToString());
            if (result.GetException() != null)
            {
                outStream.WriteLine(result.GetException().StackTrace);
            }
        }
        public ISolutionUnitTestResultsContext MustReturn(ITestResult testResult, ComparisonMode mode)
        {
            Assert.ArgumentNotNull(testResult, nameof(testResult));

            var list   = Results;
            var result = list.FirstOrDefault(x => testResult.State == x.State && (mode == ComparisonMode.Strict ? testResult.Message.ToString() == x.Message.ToString() : x.Message.ToString().StartsWith(testResult.Message.ToString())));

            if (result == null || (mode == ComparisonMode.StartsWith || result.Detailed != testResult.Detailed))
            {
                if (list.Any())
                {
                    throw new InvalidOperationException($"The test didn't return expected test result, another results were returned instead.\r\n\r\nExpected:{new BulletedList(testResult.ToString()).ToString().EmptyToNull() ?? "[EMPTY]"}\r\nActual:{new BulletedList(list).ToString().EmptyToNull() ?? "[EMPTY]"}");
                }
                else
                {
                    throw new InvalidOperationException($"The test didn't return expected test result:{new BulletedList(testResult.ToString()).ToString().EmptyToNull() ?? "[EMPTY]"}");
                }
            }
            else
            {
                list.Remove(result);
            }

            return(this);
        }