コード例 #1
0
 public void openKeypad()
 {
     puzzle.animator.SetBool("KeypadOpen", true);
     puzzle.keypad.index = this.index;
     if (puzzle.successes[this.index])
     {
         puzzle.keypad.correctLight.sprite = puzzle.lightImages[1];
     }
     else
     {
         puzzle.keypad.correctLight.sprite = puzzle.lightImages[0];
     }
     puzzle.keypad.enterButton.interactable = !puzzle.successes[this.index];
     puzzle.keypad.resetButton.interactable = !puzzle.successes[this.index];
     puzzle.keypad.value           = puzzle.values[index];
     puzzle.keypad.coordinateLabel = puzzle.coordinates[index];
     if (CameraScript.Instance.wiresConnected)
     {
         puzzle.keypad.outputText.text = RomanNum.ToRoman(puzzle.keypad.value);
         puzzle.keypad.sideText.text   = puzzle.coordinates[index] + "-COORD";
     }
     else
     {
         puzzle.keypad.value           = 0;
         puzzle.values[index]          = 0;
         puzzle.keypad.outputText.text = "";
         puzzle.keypad.sideText.text   = "";
     }
 }
コード例 #2
0
        public void numb_notEqual()
        {
            RomanNum a1 = new RomanNum(1);
            string   s1 = a1.Roman;

            a1.Dec = 2;
            string s2 = a1.Roman;

            Assert.AreNotEqual(s1, s2);
        }
コード例 #3
0
        public void Test7()
        {
            //arrange
            RomanNum r        = new RomanNum();
            var      expected = "VII";

            //act
            var actual = r.ConvertToRoman(7);

            //assert
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
        public void Test3999()
        {
            //arrange
            RomanNum r        = new RomanNum();
            var      expected = "MMMCMXCIX";

            //act
            var actual = r.ConvertToRoman(3999);

            //assert
            Assert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void roman_q_exeption()
        {
            string rom = "q";

            try
            {
                int actual = RomanNum.ConvertToDec(rom);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(string.Format(ExeptionRes.unsupportedChar, rom), ex.Message);
            }
        }
コード例 #6
0
        public void roman_xxxx_exeption()
        {
            string rom = "xxxx";

            try
            {
                int actual = RomanNum.ConvertToDec(rom);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(ExeptionRes.treeInARow, ex.Message);
            }
        }
コード例 #7
0
        public void decimal_4000_exeption()
        {
            int value = 4000;

            try
            {
                string actual = RomanNum.ConvertToRoman(value);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(ExeptionRes.wrongRange, ex.Message);
            }
        }
コード例 #8
0
        public void roman_empty_exeption()
        {
            string rom = "";

            try
            {
                int actual = RomanNum.ConvertToDec(rom);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(ExeptionRes.nullOrEmpty, ex.Message);
            }
        }
コード例 #9
0
        public void roman_vx_exeption()
        {
            string rom = "vx";

            try
            {
                int actual = RomanNum.ConvertToDec(rom);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(ExeptionRes.wrong, ex.Message);
            }
        }
コード例 #10
0
        public void roman_ixiii_exeption()
        {
            string rom        = "ixiii";
            int    dec        = 12;
            string correctRom = "XII";

            try
            {
                int actual = RomanNum.ConvertToDec(rom);
            }
            catch (ExeptionRomanNumber ex)
            {
                Assert.AreEqual(string.Format(ExeptionRes.IncorrectNumber, correctRom, dec, rom), ex.Message);
            }
        }
コード例 #11
0
 public void UpdateDisplay()
 {
     if (CameraScript.Instance.wiresConnected)
     {
         puzzle.values[this.index] = value;
         outputText.text           = RomanNum.ToRoman(value);
         sideText.text             = coordinateLabel + "-COORD";
         thoughts.sentence         = "Three keypads. They seem to be for inputting coordinates of some sort.";
     }
     else
     {
         thoughts.sentence    = "Three keypads. They don't seem to be turned on.";
         value                = 0;
         puzzle.values[index] = 0;
         outputText.text      = "";
         sideText.text        = "";
     }
 }
コード例 #12
0
        public void Test_Convert()
        {
            Dictionary <int, string> inputOutput = new Dictionary <int, string>
            {
                { 2000, "MM" },
                { 2500, "MMD" },
                { 500, "D" },
                { 21, "XXI" },
                { 24, "XXIV" },
                { 4, "IV" },
                { 44, "XLIV" },
                { 88, "LXXXVIII" },
                { 98, "XCVIII" }
            };

            foreach (var KV in inputOutput)
            {
                var v = RomanNum.Convert(KV.Key);
                Assert.IsTrue(v == KV.Value, "{0} should convert to {1}, got {2} instead.", KV.Key, KV.Value, v);
            }
        }
コード例 #13
0
 public void updateText()
 {
     text.text = chemical + ": " + RomanNum.ToRoman(value);
 }
コード例 #14
0
        public void int_to_roman(int integerVersion, string romanVersion)
        {
            string actual = RomanNum.ConvertToRoman(integerVersion);

            Assert.AreEqual(romanVersion, actual);
        }
コード例 #15
0
        public void roman_to_int(int integerVersion, string romanVersion)
        {
            int actual = RomanNum.ConvertToDec(romanVersion);

            Assert.AreEqual(integerVersion, actual);
        }