Ejemplo n.º 1
0
        public override TestResult DoTest(ITestCase testCase, int testCasesNumber, bool singleton)
        {
            var result = new TestResult { Singleton = singleton, TestCasesNumber = testCasesNumber };
            var sw = new Stopwatch();

            var c = new ServiceContainer();
            if (singleton)
            {
                sw.Start();
                c = (ServiceContainer)testCase.SingletonRegister(c);
                sw.Stop();
            }
            else
            {
                sw.Start();
                c = (ServiceContainer)testCase.TransientRegister(c);
                sw.Stop();
            }
            result.RegisterTime = sw.ElapsedMilliseconds;

            sw.Reset();
            result.ResolveTime = DoResolve(sw, testCase, c, testCasesNumber, singleton);

            c.Dispose();

            return result;
        }
Ejemplo n.º 2
0
        private static TestResult ConvertToTestResult(string result)
        {
            var results = result.Split(' ');
            var testResult = new TestResult
            {
                Singleton = results[0] == "s",
                TestCasesNumber = Convert.ToInt32(results[1]),
                RegisterTime = Convert.ToInt64(results[2]),
                ResolveTime = Convert.ToInt64(results[3])
            };

            return testResult;
        }
Ejemplo n.º 3
0
 private static void WriteFirstTestResults(TestResult testResult)
 {
     var registerType = testResult.Singleton ? "s" : "t";
     Console.Write($"{registerType} {testResult.TestCasesNumber} {testResult.RegisterTime} {testResult.ResolveTime}");
 }