private void AssertRoutine(string expName, string[] expArgs, UnitRoutineInfo routine)
        {
            Assert.AreEqual(expName, routine.Name, "Unexpected routine name");

            UnitRoutineArgumentInfo[] argumentSet = routine.Arguments;
            Assert.IsNotNull(argumentSet, "argumentSet != null");

            if (expArgs.Length != 0)
            {
                Assert.IsNotEmpty(argumentSet, "argumentSet is empty");
            }

            Assert.AreEqual(expArgs.Length, argumentSet.Length, "Unexpected argument count");
            for (int i = -1; ++i != expArgs.Length;)
            {
                AssertArgument(i, expArgs[i], argumentSet[i]);
            }
        }
        public void ParseFromFile_1Routine()
        {
            // Arrange
            string fileContent = TestTool.GetResourceFileContent("Bumblebee.buddy.compiler.tests.resources.UnitRoutineInfoTestFile1.tdil");

            // Act
            UnitRoutineInfo[] unitRoutines = UnitRoutineInfo.ParseFromFile(fileContent);

            // Assert
            Assert.IsNotNull(unitRoutines, "unitRoutines != null");
            Assert.IsNotEmpty(unitRoutines, "unitRoutines are empty");

            Assert.AreEqual(1, unitRoutines.Length, "unitRoutines.Length != 1");

            UnitRoutineInfo routine = unitRoutines[0];

            AssertRoutine("Anmeldung_an_allen_Modulen", new[] { "buero", "piNr", "piPass" }, routine);
        }
        public void ParseFromFile_3Routines()
        {
            // Arrange
            string fileContent = TestTool.GetResourceFileContent("Bumblebee.buddy.compiler.tests.resources.UnitRoutineInfoTestFile2.tdil");

            // Act
            UnitRoutineInfo[] unitRoutines = UnitRoutineInfo.ParseFromFile(fileContent);

            // Assert
            Assert.IsNotNull(unitRoutines, "unitRoutines != null");
            Assert.IsNotEmpty(unitRoutines, "unitRoutines are empty");

            Assert.AreEqual(3, unitRoutines.Length, "unitRoutines.Length != 3");

            UnitRoutineInfo routine1 = unitRoutines[0];
            UnitRoutineInfo routine2 = unitRoutines[1];
            UnitRoutineInfo routine3 = unitRoutines[2];

            AssertRoutine("Anmeldung_an_allen_Modulen", new[] { "buero", "piNr", "piPass" }, routine1);
            AssertRoutine("Routine_without_arguments", new string[0], routine2);
            AssertRoutine("Routine_with_one_argument", new [] { "arg" }, routine3);
        }
 public void ParseFromFile_ArgumentNullException_on_NULL()
 {
     Assert.Throws <ArgumentNullException>(() => UnitRoutineInfo.ParseFromFile(null));
 }
 public void ParseFromFile_ArgumentNullException_on_empty()
 {
     Assert.Throws <ArgumentNullException>(() => UnitRoutineInfo.ParseFromFile(string.Empty));
 }