/// <summary> /// Function that returns the average session duration for a month /// </summary> /// <param name="month">referenced month</param> /// <param name="year">referenced year</param> /// <returns>An object that holds the number the average session duration for a month</returns> public List <UADObject> GetAverageSessionDuration(string month, int year) { string[] logID = { "EntryToWebsite", "ExitFromWebsite" }; string[] informationList = { "Average Session Duration", "Minimum Session Duration", "Maximum Session Duration" }; var sessions = new List <GNGLog>(); var sessionInfo = new List <string> { "0", "0", "0" }; loglist = _gngLoggerService.ReadLogsGivenMonthYear(month, year); // Get two seperate logs var entryToWebsite = _uadService.GetLogswithID(loglist, logID[0]); // Get exit from website logs var exitFromWebsite = _uadService.GetLogswithID(loglist, logID[1]); // Pair sessions beginning and ending logs sessions = _uadService.PairStartAndEndLogs(entryToWebsite, exitFromWebsite); if (sessions.Count > 0) { sessionInfo = _uadService.CalculateSessionInformation(sessions); } var date = month + " " + year; monthsUsed.Add(date); uadObjects.AddRange(_uadService.ConvertListToUADObjects(monthsUsed, informationList, sessionInfo)); monthsUsed.Clear(); return(uadObjects); }
public void GetLogswithID_Pass_IDNotLogged() { //Arrange bool expected = true; bool actual = false; string logID = "EventDeleted"; 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); logList = _uadService.GetLogswithID(logList, logID); if (logList.Count == 0) { actual = true; } // Assert Assert.AreEqual(actual, expected); }
public void GetLogswithID_Pass() { // Arrange IUADService _uadService = new UADService(); LoggerService _loggerService = new LoggerService(); bool expected = true; bool actual = false; string logID = "ClickEvent"; // Read testlogs from this path 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); logList = _uadService.GetLogswithID(logList, logID); if (logList.Count == 4) { actual = true; } Assert.AreEqual(actual, expected); }