protected void SetUp()
 {
     uniqueNumbers   = new List <int>();                               // Make an empty int list
     randomNumberGen = new RandomNumberGen_Service(ref uniqueNumbers); // Get instance of RandomNumberGen_Service
     io           = new RandomNumberGen_IO();                          // Get instance of RandomNumberGen_IO
     terminalMock = new TerminalMock(new string[] { "--debug" });      // Create terminal mock with debug flag to enable logs
 }
Exemplo n.º 2
0
        static List <int> uniqueNumbers = new List <int>(); // List that gets filled with the numbers

        /// <summary>
        /// Main function, fills a list with X random numbers
        /// </summary>
        /// <param name="args">Console params [--debug (turns on console logs)]</param>
        static void Main(string[] args)
        {
            // Handle console params
            RandomNumberGen_Util.HandleConsoleParams(args);

            // Create RandomNumberGen service
            RandomNumberGen_Service randomNumberGen = new RandomNumberGen_Service(ref uniqueNumbers);

            // Create RandomNumberGen IO
            RandomNumberGen_IO io = new RandomNumberGen_IO();

            // Fill the list with unique random numbers
            for (int i = 1; i < AMOUNT_OF_GENERATIONS; i++)
            {
                uniqueNumbers.Add(randomNumberGen.GetUniqueRandomNumber());
            }

            // DEBUG
            uniqueNumbers.ForEach((uniqueNumber) => RandomNumberGen_Util.DebugLine(string.Format("UniqueNumber: {0}", uniqueNumber)));

            // Write numbers to file (output.txt) in current directory
            io.WriteToFile(uniqueNumbers);

            // DEBUG
            RandomNumberGen_Util.DebugLine(string.Format("Done writing numbers to {0}", OUTPUT_FILE_NAME));
        }