Exemple #1
0
        /// <summary>
        /// Function that gets the number of successful logins compared to the number of Failed logins for a specfied month and year
        /// </summary>
        /// <param name="month">referenced month</param>
        /// <param name="year">referenced year</param>
        /// <returns></returns>
        public List <UADObject> GetLoginSuccessFail(string month, int year)
        {
            string[] logID           = { "EntryToWebsite", "FailedLogin" };
            string[] informationList = { "Successful Logins", "Unsuccessful Logins" };
            var      valueList       = new List <string>();
            var      monthIndex      = months.IndexOf(month);

            loglist = _gngLoggerService.ReadLogsGivenMonthYear(months[monthIndex], year);
            valueList.Add(_uadService.GetNumberofLogsID(loglist, logID[0]).ToString());
            valueList.Add(_uadService.GetNumberofLogsID(loglist, logID[1]).ToString());
            var date = months[monthIndex] + " " + year;

            monthsUsed.Add(date);
            uadObjects.AddRange(_uadService.ConvertListToUADObjects(monthsUsed, informationList, valueList));
            monthsUsed.Clear();

            return(uadObjects);
        }
Exemple #2
0
        public void GetNumberofLogsID_Pass()
        {
            // Arrange
            bool          expected = true;
            bool          actual   = false;
            string        logID    = "ClickEvent";
            string        path     = "C:\\Users\\Midnightdrop\\Documents\\GitHub\\GreetNGroup\\Backend\\UnitTest\\UADTest\\TestLogs\\ServiceLogs\\PassLogs";
            List <GNGLog> logList  = new List <GNGLog>();

            // Act
            logList = _loggerService.ReadLogsPath(path);
            int numOfLogs = _uadService.GetNumberofLogsID(logList, logID);

            if (numOfLogs == 4)
            {
                actual = true;
            }
            Assert.AreEqual(actual, expected);
        }