コード例 #1
0
        public void CreatingRepresentationOfNumberInNewSystemTest(int acceptedNumber, int ecceptedFoundetion, string result)
        {
            NumberInNewSystem numberinNewSystem = new NumberInNewSystem(acceptedNumber, ecceptedFoundetion);
            string            actial            = numberinNewSystem.CreatingRepresentationOfNumberInNewSystem();

            Assert.AreEqual(result, actial);
        }
コード例 #2
0
        public void CreatingRepresentationOfNumberInNewSystemTest_ArgumentOutOfRangeException(int acceptedNumber, int ecceptedFoundetion)
        {
            NumberInNewSystem numberinNewSystem = new NumberInNewSystem(acceptedNumber, ecceptedFoundetion);

            Assert.Throws <ArgumentOutOfRangeException>
            (
                () => numberinNewSystem.CreatingRepresentationOfNumberInNewSystem()
            );
        }
コード例 #3
0
 static void Main(string[] args)
 {
     try
     {
         int digitForTranslation;
         int foundationOfNewsystem;
         digitForTranslation   = Int32.Parse(args[0]);
         foundationOfNewsystem = Int32.Parse(args[1]);
         NumberInNewSystem convertedString = new NumberInNewSystem(digitForTranslation, foundationOfNewsystem);
         Console.WriteLine("Number in the new system of calculation : " + convertedString.CreatingRepresentationOfNumberInNewSystem());
     }
     catch (ArgumentOutOfRangeException)
     {
         Console.WriteLine("You entered the base of the new system not from the allowed range. Please enter another base of the new system ");
     }
     catch (FormatException)
     {
         Console.WriteLine("you entered incorrect arguments");
     }
     catch (Exception)
     {
         Console.WriteLine("You entered an empty string");
     }
 }