コード例 #1
0
        public void CanLiftUserDefinedConversionOperator()
        {
            S7?a = new S7(42), b = null;

            Assert.AreEqual((double?)a, 42, "#1");
            Assert.IsNull((double?)b, "#2");
        }
コード例 #2
0
        public void CanLiftUserDefinedBinaryOperator()
        {
            S7?a = new S7(42), b = new S7(32), c = null;

            Assert.AreEqual((a + b).Value.I, 74, "#1");
            Assert.IsNull((a + c), "#2");
        }
コード例 #3
0
        public void CanLiftUserDefinedUnaryOperator()
        {
            S7?a = new S7(42), b = null;

            Assert.AreEqual(-a.Value.I, -42, "#1");
            Assert.IsNull(-b, "#2");
        }
コード例 #4
0
        public void CanLiftUserDefinedUnaryOperator_SPI_1634()
        {
            S7?a = new S7(42), b = null;

            Assert.AreEqual(-42, -a.Value.I, "#1");
            // #1634 #SPI
            Assert.Null(-b, "#2");
        }
コード例 #5
0
        public void CanLiftUserDefinedConversionOperator_SPI_1611()
        {
            S7?    a = new S7(42), b = null;
            double?d1 = null;

            TestHelper.Safe(() => d1 = (double?)a);
            Assert.AreEqual(42, d1, "#1");
            // #1611
            double?d2 = 1;

            TestHelper.Safe(() => d2 = (double?)b);
            Assert.Null(d2, "#2");
        }