Beispiel #1
0
    public static void TestFromOver()
    {
        CustomLogger.LogDebug("Testing: TestFromOver()");
        FizzBuzzModel fbm = new FizzBuzzModel(_config);

        try {
            fbm.getList(max + 1);
            CustomLogger.LogDebug("Testing: TestFromOver() unsuccessful, no exceptions found");
        } catch (CustomException e) {
            CustomLogger.LogError("Testing: TestFromOver() successful: " + e.Message);
        }
    }
        public string[] Get(int start)
        {
            CustomLogger.LogInformation("Get FizzBuzz list: " + start);

            string[] list;

            try {
                list = fbm.getList(start);
            } catch (CustomException e) {
                CustomLogger.LogError(e.Message);
                list = new string[] { "error, see log for details: " + CustomLogger.GetLogPath() };
            }

            return(list);
        }
Beispiel #3
0
    public static void TestAsync()
    {
        CustomLogger.LogDebug("Testing: TestAsync()");
        FizzBuzzModel fbm = new FizzBuzzModel(_config);

        Task[] tasks = new Task[max - 1];

        try {
            for (int i = 1; i < max; i++)
            {
                tasks[i - 1] = Task.Run(() => fbm.getList(i));
            }

            foreach (Task t in tasks)
            {
                t.Wait();
            }

            CustomLogger.LogDebug("Testing: TestAsync successful");
        } catch (Exception e) {
            CustomLogger.LogError("Testing: TestAsync() unsuccessful: " + e.Message);
        }
    }