public IEnumerable <LogTemplate> GetMessageTemplates()
        {
            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs() == false)
            {
                throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Unable to view logs, due to size"));
            }

            return(_logViewer.GetMessageTemplates(startDate: DateTime.Now.AddDays(-1), endDate: DateTime.Now));
        }
Exemplo n.º 2
0
        public ActionResult <IEnumerable <LogTemplate> > GetMessageTemplates([FromQuery] DateTime?startDate = null, [FromQuery] DateTime?endDate = null)
        {
            var logTimePeriod = GetTimePeriod(startDate, endDate);

            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs(logTimePeriod) == false)
            {
                return(ValidationProblem("Unable to view logs, due to size"));
            }

            return(new ActionResult <IEnumerable <LogTemplate> >(_logViewer.GetMessageTemplates(logTimePeriod)));
        }
Exemplo n.º 3
0
        public IEnumerable <LogTemplate> GetMessageTemplates([FromUri] DateTime?startDate = null, [FromUri] DateTime?endDate = null)
        {
            var logTimePeriod = GetTimePeriod(startDate, endDate);

            //We will need to stop the request if trying to do this on a 1GB file
            if (CanViewLogs(logTimePeriod) == false)
            {
                throw new HttpResponseException(Request.CreateNotificationValidationErrorResponse("Unable to view logs, due to size"));
            }

            return(_logViewer.GetMessageTemplates(logTimePeriod));
        }
Exemplo n.º 4
0
        public void Logs_Contains_Correct_Message_Templates()
        {
            IEnumerable <LogTemplate> templates = _logViewer.GetMessageTemplates(_logTimePeriod);

            // Count no of templates
            Assert.AreEqual(25, templates.Count());

            // Verify all templates & counts are unique
            CollectionAssert.AllItemsAreUnique(templates);

            // Ensure the collection contains LogTemplate objects
            CollectionAssert.AllItemsAreInstancesOfType(templates, typeof(LogTemplate));

            // Get first item & verify its template & count are what we expect
            LogTemplate popularTemplate = templates.FirstOrDefault();

            Assert.IsNotNull(popularTemplate);
            Assert.AreEqual("{EndMessage} ({Duration}ms) [Timing {TimingId}]", popularTemplate.MessageTemplate);
            Assert.AreEqual(26, popularTemplate.Count);
        }
        public void Logs_Contains_Correct_Message_Templates()
        {
            var templates = _logViewer.GetMessageTemplates(startDate: _startDate, endDate: _endDate);

            //Count no of templates
            Assert.AreEqual(43, templates.Count());

            //Verify all templates & counts are unique
            CollectionAssert.AllItemsAreUnique(templates);

            //Ensure the collection contains LogTemplate objects
            CollectionAssert.AllItemsAreInstancesOfType(templates, typeof(LogTemplate));

            //Get first item & verify its template & count are what we expect
            var popularTemplate = templates.FirstOrDefault();

            Assert.IsNotNull(popularTemplate);
            Assert.AreEqual("{LogPrefix} Task added {TaskType}", popularTemplate.MessageTemplate);
            Assert.AreEqual(689, popularTemplate.Count);
        }