コード例 #1
0
        public void TestDivZeroComplex()
        {
            MyComplex a = new MyComplex(1, 2);
            MyComplex b = new MyComplex();

            Assert.Throws <DivideByZeroException>(() => a.Divide(b));
        }
コード例 #2
0
        public void TestDivComplex()
        {
            MyComplex f1   = new MyComplex(1, 2);
            MyComplex f2   = new MyComplex(3, -4);
            var       quot = f1 / f2;

            Assert.True(quot == f1.Divide(f2));
            Assert.True(quot.Re == -5 / 25.0);
            Assert.True(quot.Im == 10 / 25.0);
        }