예제 #1
0
        public void RomanNumeral_Parse_InvalidClassicNotation()
        {
            //substractive notation
            Assert.IsNull(RomanNumeral.Parse("IV"));
            Assert.IsNull(RomanNumeral.Parse("IX"));

            //invalid order
            Assert.IsNull(RomanNumeral.Parse("IVL"));

            //valid order
            Assert.IsNotNull(RomanNumeral.Parse("LVI"));
        }
예제 #2
0
        public void RomanNumeral_Assign_Int()
        {
            RomanNumeral x = 4;

            Assert.AreEqual(4, x.Number);
        }
예제 #3
0
        public void RomanNumeral_Add_Int()
        {
            var x = new RomanNumeral(0) + 4;

            Assert.AreEqual(4, x.Number);
        }
예제 #4
0
        public void RomanNumeral_Add_StringAndInt()
        {
            var x = new RomanNumeral(0) + "IV" + 4;

            Assert.AreEqual(8, x.Number);
        }
예제 #5
0
        public void RomanNumeral_Assign_String()
        {
            RomanNumeral x = "IV";

            Assert.AreEqual(4, x.Number);
        }
예제 #6
0
        public void RomanNumeral_Add_IntAndString()
        {
            var x = new RomanNumeral(0) + 4 + "IV";

            Assert.AreEqual(8, x.Number);
        }
예제 #7
0
        public void RomanNumeral_Add_String()
        {
            var x = new RomanNumeral(0) + "IV";

            Assert.AreEqual(4, x.Number);
        }
        public static string operator -(string r1, RomanNumeral r2)
        {
            var r = RomanNumeral.Parse(r1) + r2;

            return(r.ToString());
        }
        public static int operator -(int r1, RomanNumeral r2)
        {
            var r = new RomanNumeral(r1) - r2;

            return(r.Number);
        }
 public static RomanNumeral operator +(RomanNumeral r1, string r2)
 {
     return(r1 + RomanNumeral.Parse(r2));
 }