示例#1
0
 public void LogAdapter_UnableToSetNullAsLogAdapter()
 {
     Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
     {
         TagScopeManager.LogAdapter = null;
     }));
 }
示例#2
0
    private void button1_Click(object sender, EventArgs e)
    {
        DateTime      start      = DateTime.Now;
        bool          PreCheck   = chkPrecheck.Checked;
        bool          NoThrow    = chkNoThrow.Checked;
        int           divisor    = (chkZero.Checked ? 0 : 1);
        int           Iterations = Convert.ToInt32(txtIterations.Text);
        int           i          = 0;
        ExceptionTest x          = new ExceptionTest();
        int           r          = -2;
        int           stat       = 0;

        for (i = 0; i < Iterations; i++)
        {
            try
            {
                r = x.TryDivide(divisor, PreCheck, NoThrow);
            }
            catch
            {
                stat = -3;
            }
        }
        DateTime stop    = DateTime.Now;
        TimeSpan elapsed = stop - start;

        txtTime.Text   = elapsed.TotalMilliseconds.ToString();
        txtReturn.Text = r.ToString();
        txtStatus.Text = stat.ToString();
    }
示例#3
0
        public void TagCollections_IndexerGet_ThrowsOnTagKeyThatIsNull()
        {
            using (var scope = TagScopeManager.CreateScope())
            {
                scope.Tags.Add("tag", "value");

                // Access to existing tag. Expected result: success.
                Assert.AreEqual("value", scope.Tags["tag"]);

                // Access to tag that does not exist.
                // Expected result: ArgumentNullException( "Tag key cannot be null." )
                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(scope.Tags[null]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(scope.InheritedTags[null]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(scope.EffectiveTags[null]);
                }));

                TestWithNestedScope();
            }
        }
示例#4
0
        public void TagCollections_IndexerGet_ThrowsOnTagKeyThatDoesNotExistTest()
        {
            // ReSharper disable AccessToDisposedClosure

            using (var scope = TagScopeManager.CreateScope())
            {
                scope.Tags.Add("tag", "value");

                // Access to existing tag. Expected result: success.
                Assert.AreEqual("value", scope.Tags["tag"]);

                // Access to tag that does not exist.
                // Expected result: ArgumentException( "The given tag key was not present in the tag collection." )
                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(scope.Tags["not_a_tag"]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(scope.InheritedTags["not_a_tag"]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(scope.EffectiveTags["not_a_tag"]);
                }));

                TestWithNestedScope();
            }

            // ReSharper restore AccessToDisposedClosure
        }
示例#5
0
    /**
     * main.
     *
     * @param args
     */
    public static void main(string[] args)
    {
        int nbTests             = (args != null && args.Length >= 1) ? int.Parse(args[0]) : NB_TESTS;
        int nbOfExclusionMinMax = (args != null && args.Length >= 2) ? int.Parse(args[1]) : NB_OF_EXCLUSION_MIN_MAX;

        List <long> executionTimes = new List <long>(nbTests);

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(ExceptionTest.testUncheckedException());
        }
        executionTimes.Sort();
        Console.WriteLine("[ExceptionTest], Throw and catch RuntimeException " + NB_EXCEPTION_TESTS + " try {throw new RuntimeException()} catch (RuntimeException e) {  },, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();

        for (int i = nbTests; i != 0; i--)
        {
            executionTimes.Add(ExceptionTest.testUncheckedExceptionWithDeepTry());
        }
        executionTimes.Sort();
        Console.WriteLine("[ExceptionTest], Throw and catch RuntimeException with deep try (5) " + NB_EXCEPTION_TESTS + " try { try { try { try { try {throw new RuntimeException()  } catch (RuntimeException e) {},, average time,"
                          + averageTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax) + ", min time," + executionTimes[0] + ", max time," + executionTimes[executionTimes.Count - 1]
                          + ", relative deviation time," + relativeDeviationTimeWithoutMinMax(executionTimes, nbOfExclusionMinMax));
        executionTimes.Clear();
    }
示例#6
0
        /// <summary>
        /// This fragment implemented as a separate method
        /// to isolate nested scope from parent scope
        /// and prevent some really annoying problems with
        /// mess with acident "scope" and "nestedScope" calls
        /// while they are in one method.
        /// </summary>
        static void TestWithNestedScope()
        {
            // ReSharper disable AccessToDisposedClosure

            using (var nestedScope = TagScopeManager.CreateScope())
            {
                // Access to tag that does not exist.
                // Expected result: ArgumentException( "The given tag key was not present in the tag collection." )
                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(nestedScope.Tags["not_a_tag"]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(nestedScope.InheritedTags["not_a_tag"]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    Assert.IsNull(nestedScope.EffectiveTags["not_a_tag"]);
                }));
            }

            // ReSharper restore AccessToDisposedClosure
        }
示例#7
0
        public void CreateExpressionTest()
        {
            var           ex     = new System.Exception("MessageTest");
            ExceptionTest result = Instance.Create <ExceptionTest, System.Exception>(ex, c => c.Message);

            Assert.NotNull(result);
            Assert.Equal("MessageTest", result.Message);
        }
 private static bool Validate(ExceptionTest value)
 {
     if (value == ExceptionTest.ThrowInValidation)
     {
         throw new InvalidOperationException();
     }
     return(false);
 }
 private static string Message(ExceptionTest value)
 {
     if (value == ExceptionTest.ThrowInMessage)
     {
         throw new InvalidOperationException();
     }
     return("Message");
 }
 public void Exception_Validation_Sends_ValidationUpdate()
 {
     var data = new ExceptionTest { MustBePositive = 5 };
     var observer = new ExpressionObserver(data, nameof(data.MustBePositive), false);
     var validationMessageFound = false;
     observer.Where(o => o is IValidationStatus).Subscribe(_ => validationMessageFound = true);
     observer.SetValue(-5);
     Assert.True(validationMessageFound);
 }
示例#11
0
 private void Start()
 {
     Debug.LogError("##Start 1");
     other = new ExceptionTest();
     Debug.LogError("##Start 2");
     other.callback = TestCallbackException;
     Debug.LogError("##Start 3");
     //Application.focusChanged += OnFocusNullPointException;
     Application.focusChanged += OnFocusCallbackException;
     Debug.LogError("##Start 4");
 }
        public void Exception_Validation_Sends_ValidationUpdate()
        {
            var data = new ExceptionTest {
                MustBePositive = 5
            };
            var observer = new ExpressionObserver(data, nameof(data.MustBePositive), false);
            var validationMessageFound = false;

            observer.Where(o => o is IValidationStatus).Subscribe(_ => validationMessageFound = true);
            observer.SetValue(-5);
            Assert.True(validationMessageFound);
        }
        public void Exception_Validation_Sends_DataValidationError()
        {
            var data = new ExceptionTest { MustBePositive = 5 };
            var observer = new ExpressionObserver(data, nameof(data.MustBePositive), true);
            var validationMessageFound = false;

            observer.OfType<BindingNotification>()
                .Where(x => x.ErrorType == BindingErrorType.DataValidationError)
                .Subscribe(_ => validationMessageFound = true);
            observer.SetValue(-5);

            Assert.True(validationMessageFound);
        }
示例#14
0
        public void Exception_Validation_Sends_DataValidationError()
        {
            var data = new ExceptionTest {
                MustBePositive = 5
            };
            var observer = new ExpressionObserver(data, nameof(data.MustBePositive), true);
            var validationMessageFound = false;

            observer.OfType <BindingNotification>()
            .Where(x => x.ErrorType == BindingErrorType.DataValidationError)
            .Subscribe(_ => validationMessageFound = true);
            observer.SetValue(-5);

            Assert.True(validationMessageFound);
        }
示例#15
0
        public void TestThrowException()
        {
            //Mock<BaseTest> testMock = new Mock<BaseTest>();
            //testMock.Setup(s => s.Execute()).Throws(new FailException());
            ExceptionTest testMock = new ExceptionTest();

            testMock.BreakOnFail = true;
            TestSuite testSuite = new TestSuite();

            testSuite.Tests.Add(testMock);
            testSuite.BreakOnFail = false;
            testSuite.Execute();
            testSuite.Summary.ShowStackTrace = true;
            Assert.IsNotNull(testSuite.Summary.ToString());
            Assert.IsTrue(testSuite.Summary.ToString() is String);
        }
        public void Doesnt_Send_DataValidationError_When_DataValidatation_Not_Enabled()
        {
            var data = new ExceptionTest {
                MustBePositive = 5
            };
            var observer = new ExpressionObserver(data, nameof(data.MustBePositive), false);
            var validationMessageFound = false;

            observer.OfType <BindingNotification>()
            .Where(x => x.ErrorType == BindingErrorType.DataValidationError)
            .Subscribe(_ => validationMessageFound = true);
            observer.SetValue(-5);

            Assert.False(validationMessageFound);

            GC.KeepAlive(data);
        }
示例#17
0
        public void WhenDisposed_ShouldDisposeAlgorithm()
        {
            // Arrange
            var fixture  = new Fixture();
            var values   = fixture.Create <byte[]>();
            var expected = typeof(ObjectDisposedException);

            // TODO: Mock Crypto.HashAlgorithm?
            var hashAlgorithm = Crypto.MD5.Create();
            var algorithm     = new HashingLibrary.Algorithms.CryptographyWrapper(hashAlgorithm);

            algorithm.Dispose();

            // Act
            var actual = ExceptionTest.Catch(() => hashAlgorithm.ComputeHash(values));

            // Assert
            Assert.IsInstanceOfType(actual, expected);
        }
示例#18
0
        public void TestSuiteException()
        {
            ExceptionTest test = new ExceptionTest();

            test.Execute();
            Assert.IsTrue(test.TestResult.Executed);
            Assert.IsFalse(test.TestResult.Succeeded);
            ExceptionTest test2 = new ExceptionTest();

            try
            {
                test2.BreakOnFail = true;
                test2.Execute();
            }
            catch (Exception e)
            {
                return;
            }
            Assert.IsTrue(false);
        }
示例#19
0
        /// <summary>
        /// This fragment implemented as a separate method
        /// to isolate nested scope from parent scope
        /// and prevent some really annoying problems with
        /// mess with acident "scope" and "nestedScope" calls
        /// while they are in one method.
        /// </summary>
        static void TestWithNestedScope()
        {
            using (var nestedScope = TagScopeManager.CreateScope())
            {
                // Expected result: ArgumentNullException( "Tag key cannot be null." )
                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(nestedScope.Tags[null]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(nestedScope.InheritedTags[null]);
                }));

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentNullException>(() =>
                {
                    Assert.IsNull(nestedScope.EffectiveTags[null]);
                }));
            }
        }
示例#20
0
        public void TagCollections_RemoveThrowsOnTagKeyThatIsNull()
        {
            // ReSharper disable AccessToDisposedClosure

            using (var scope = TagScopeManager.CreateScope())
            {
                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    scope.Tags.Remove(null);
                }));

                scope.Tags.Add("tag1", "value1");
                scope.Tags.Add("tag2", "value2");

                Assert.IsTrue(ExceptionTest.IsThrown <ArgumentException>(() =>
                {
                    scope.Tags.Remove(null);
                }));
            }

            // ReSharper restore AccessToDisposedClosure
        }
    private void RunTest(TestType testType, bool RunBaseLine = true)
    {
        PerformanceTest test       = null;
        int             iterations = int.Parse(inputField.text);

        switch (testType)
        {
        case TestType.Exception:
            test = new ExceptionTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Strings:
            test = new StringsTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Arrays:
            test = new ArraysTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Boxing:
            test = new BoxingTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.ForForeach:
            test = new ForForeachTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Struct:
            test = new StructTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Memory:
            test = new MemoryTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Instantiation:
            test = new InstantiationTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        case TestType.Properties:
            test = new PropertiesTest {
                RunBaseline = RunBaseLine, Iterations = iterations
            };
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(testType), testType, null);
        }

        titleText.text       = test.Name;
        descriptionText.text = test.Description;
        var averageResult = test.Measure();

        lastPerformanceResult = averageResult;
        UpdatePerformanceResultUI();

        var(perA, perB, perC) = GetPercentageOfResult(averageResult);
        totalASlider.value    = perA;
        totalBSlider.value    = perB;
        totalCSlider.value    = perC;
    }
示例#22
0
        private static void Basic()
        {
            // 1. DataType
            Console.WriteLine("=================== Data Type ================");
            var dt = new DataType();

            dt.Test();

            // 2. Variable And Constant
            Console.WriteLine("=================== Variable & Constant ================");
            var vnc = new VariableAndConstant();

            vnc.Test();

            // 3. Array
            Console.WriteLine("=================== Array ================");
            var arr = new ArrayTest();

            arr.Test();

            // 4. String
            Console.WriteLine("=================== String ================");
            var strTest = new StringTest();

            strTest.Test();

            // 5. Enum
            Console.WriteLine("=================== Enum ================");
            var enumTest = new EnumTest();

            enumTest.Test();

            // 6. Operator
            Console.WriteLine("=================== Operator ================");
            var operatorTest = new OperatorTest();

            operatorTest.Test();

            // 7. If
            Console.WriteLine("=================== If ================");
            var ifTest = new IfTest();

            ifTest.Test();

            // 8. loop
            Console.WriteLine("=================== Loop ================");
            var loopTest = new LoopTest();

            loopTest.Test();

            // 9. yield keword: when collection data can be returned one by one in turn
            Console.WriteLine("=================== yield return ================");
            var yieldReturnTest = new yieldTest();

            yieldReturnTest.Test();

            // 10. Exception
            Console.WriteLine("=================== Exception ================");
            var exceptionTest = new ExceptionTest();

            exceptionTest.Test(0, 0);

            // 11. Struct
            Console.WriteLine("=================== Struct ================");
            var structTest = new StructTest();

            structTest.ToString();

            // 12. Nullable
            Console.WriteLine("=================== Nullable ================");
            var nullableTest = new NullableTest();

            nullableTest.Test(null, null, DateTime.Now, null);

            // 13. Method
            Console.WriteLine("=================== Method ================");
            var methodTest = new MethodTest();
            // 13-1
            int val = 1000;

            methodTest.TestPassByValue(val);

            Console.WriteLine("variable val's value is not changed: {0}", val);
            // 13-2
            int    x   = 0;
            double y   = 1.0;
            double ret = methodTest.TestPassByRef(ref x, ref y);

            Console.WriteLine("variable val's value is actually changed: x: {0} y: {1}", x, y);

            Console.WriteLine(x);
            Console.WriteLine(y);

            // 13-3
            int  c, d;
            bool bret = methodTest.TestPassByOut(10, 20, out c, out d);

            Console.WriteLine("variable val's value is actually changed: c: {0} d: {1}", c, d);

            // differenc between ref keyword and out keyword

            // 13-4.
            var returnValue = methodTest.TestDefaultParam(1, 2);

            Console.WriteLine("Default parameter test: " + returnValue);
            var returnValue2 = methodTest.TestDefaultParam(1, 2, "-----");

            // 13-5.
            var returnParamsValue = methodTest.TestParams(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

            Console.WriteLine("params keyword test: " + returnParamsValue);
        }
 void ExplicitAdd(ITagScope scope)
 {
     Assert.IsTrue(ExceptionTest.IsThrown <Exception>(
                       () => scope.Tags[Constants.ThreadCorrelationIdTagKey] = ThreadCorrelationIdValue));
 }
 void ExplicitRemove(ITagScope scope)
 {
     Assert.IsTrue(ExceptionTest.IsThrown <Exception>(
                       () => scope.Tags.Remove(Constants.ThreadCorrelationIdTagKey)));
 }
 void ExplicitUpdate(ITagScope scope)
 {
     Assert.IsTrue(ExceptionTest.IsThrown <Exception>(
                       () => scope.Tags[ThreadCorrelationIdValue] = Constants.ThreadCorrelationIdTagKey));
 }
示例#26
0
    public static void Main(string[] args)
    {
        StreamWriter sw = null;

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("getter-setter-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        GetterSetterTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("getter-setter-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        GetterSetterTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("invoke-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        InvokeTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("invoke-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        InvokeTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("creation-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        CreationTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("creation-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        CreationTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("collection-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        CollectionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("collection-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        CollectionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("arithmetic-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ArithmeticTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("arithmetic-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ArithmeticTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("threading-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ThreadingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("threading-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ThreadingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("timing-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        TimingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("timing-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        TimingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("autoboxing-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        AutoboxingTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("autoboxing-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        AutoboxingTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("file-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        FileTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("file-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        FileTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("exception-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ExceptionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("exception-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ExceptionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("recursive-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        RecursiveTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("recursive-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        RecursiveTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("stringconcat-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        StringConcatTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("stringconcat-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        StringConcatTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("nestedloops-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        NestedLoopsTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("nestedloops-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        NestedLoopsTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("heap-sort-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        HeapSortTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("heap-sort-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        HeapSortTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("matrix-multiply-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        MatrixMultiplyTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("matrix-multiply-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        MatrixMultiplyTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("reflection-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        ReflectionTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("reflection-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        ReflectionTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("enum-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        EnumTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("enum-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        EnumTest.main(ARGS);
        sw.Close();


        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("trigo-benchmark-csharp-firstinvoke.csv", FileMode.Create));
        Console.SetOut(sw);
        TrigoTest.main(ARGS);
        sw.Close();

        LaunchGcAndSleep();
        sw = new StreamWriter(new FileStream("trigo-benchmark-csharp.csv", FileMode.Create));
        Console.SetOut(sw);
        TrigoTest.main(ARGS);
        sw.Close();


        //TODO NetworkInvoke.main(ARGS);
    }
示例#27
0
 public void ExceptionRandomShapesTest()
 {
     //NewMethod("You must specify the number of random shapes you want to generate");
     ExceptionTest.TestExceptionMessage("You must specify the number of random shapes you want to generate", NewMethod);
 }