public void GetWorkItemByYearMonth_Default_Return()
        {
            var list = new List <WorkItem>()
            {
                new WorkItem {
                    CreateUserID = 1
                }
            };

            _dbMock.Setup(db => db.Query <WorkItem>(It.IsAny <string>(), It.IsAny <object>(), null, true, null, null)).Returns(list);
            var workitems = _workItemRepository.GetWorkItemByYearMonth(2017, 10, 1);

            Assert.Equal(31, workitems.Count);
        }
Ejemplo n.º 2
0
        public IActionResult QueryMyWork(int year, int month)
        {
            try
            {
                _logger.LogInformation($"按年月查询某人工作记录:year={year},month={month}");

                var workItems = _workItemRepository.GetWorkItemByYearMonth(year, month, UserID);
                return(ToJson(BackResult.Success, data: workItems));
            }
            catch (Exception exc)
            {
                _logger.LogCritical(exc, $"按年月查询某人工作记录:{ exc.Message}");
                return(ToJson(BackResult.Exception, message: exc.Message));
            }
        }