コード例 #1
0
ファイル: UADTest.cs プロジェクト: Erleh/GC-GreetNGroup
        public void GetAverageSessionMonthly_Pass()
        {
            // Assign
            bool expected      = true;
            bool actual        = false;
            var  expectedDates = new List <string> {
                "June 1", "May 1", "April 1", "March 1", "February 1", "January 1"
            };
            var expectedDuration = new List <string> {
                "0", "0", "180", "956.73", "533.47", "0"
            };
            var actualDuration = new List <string>();
            var actualMonths   = new List <string>();
            var actualDates    = new List <string>();
            // Act
            var test = uadManager.GetAverageSessionMonthly("June", 1);

            for (int i = 0; i < test.Count; i++)
            {
                actualDates.Add(test[i].Date);
                actualDuration.Add(test[i].Value);
            }
            if (expectedDuration.SequenceEqual(actualDuration) && expectedDates.SequenceEqual(actualDates))
            {
                actual = true;
            }
            // Assert
            Assert.AreEqual(actual, expected);
        }
コード例 #2
0
ファイル: UADController.cs プロジェクト: Erleh/GC-GreetNGroup
        public IHttpActionResult GetAverageSessionMonthly(string month, int year)
        {
            UADManager _uadManager = new UADManager();

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