Ejemplo n.º 1
0
        public void GetTop5AveragePageSession_Pass()
        {
            // Assign
            bool expected     = true;
            bool actual       = false;
            var  expectedUrls = new List <string> {
                "https://www.greetngroup.com/search", "https://www.greetngroup.com/createevent", "https://www.greetngroup.com", "https://www.greetngroup.com/faq", "https://www.greetngroup.com/help"
            };
            var expectedDuration = new List <string> {
                "150", "60", "60", "0", "0"
            };
            var actualUrls     = new List <string>();
            var actualDuration = new List <string>();

            // Act
            var test = uadManager.GetTop5AveragePageSession("June", 1);

            for (int i = 0; i < test.Count; i++)
            {
                actualUrls.Add(test[i].InfoType);
                actualDuration.Add(test[i].Value);
            }
            if (actualUrls[10].CompareTo(expectedUrls[0]) == 0 && actualUrls[11].CompareTo(expectedUrls[1]) == 0 && actualUrls[12].CompareTo(expectedUrls[2]) == 0 && actualUrls[13].CompareTo(expectedUrls[3]) == 0 && actualUrls[14].CompareTo(expectedUrls[4]) == 0 &&
                actualDuration[10].CompareTo(expectedDuration[0]) == 0 && actualDuration[11].CompareTo(expectedDuration[1]) == 0 && actualDuration[12].CompareTo(expectedDuration[2]) == 0 && actualDuration[13].CompareTo(expectedDuration[3]) == 0 && actualDuration[14].CompareTo(expectedDuration[4]) == 0)
            {
                actual = true;
            }
            // Assert
            Assert.AreEqual(actual, expected);
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetTop5AveragePageSession(string month, int year)
        {
            UADManager _uadManager = new UADManager();

            try
            {
                var result = _uadManager.GetTop5AveragePageSession(month, year);
                return(Ok(result));
            }
            catch (HttpRequestException error)
            {
                _gngLoggerService.LogBadRequest("", "", url, error.ToString());
                return(BadRequest());
            }
        }