Пример #1
0
        public void GetLoggedinMonthly_Pass()
        {
            // Arrange
            bool expected      = true;
            bool actual        = false;
            var  expectedDates = new List <string> {
                "June 1", "May 1", "April 1", "March 1", "February 1", "January 1"
            };
            var expectedLogins = new List <string> {
                "0", "0", "3", "2", "1", "0"
            };
            var actualDates = new List <string>();
            var actualLogin = new List <string>();
            // Act
            var test = uadManager.GetLoggedInMonthly("June", 1);

            for (int i = 0; i < test.Count; i++)
            {
                actualDates.Add(test[i].Date);
                actualLogin.Add(test[i].Value);
            }
            if (expectedDates.SequenceEqual(actualDates) && expectedLogins.SequenceEqual(actualLogin))
            {
                actual = true;
            }
            // Assert
            Assert.AreEqual(actual, expected);
        }
Пример #2
0
        public IHttpActionResult GetLoggedInMonthly(string month, int year)
        {
            UADManager _uadManager = new UADManager();

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