示例#1
0
        public async void GetUserEventLogsReturnsNoneTest()
        {
            var eventLogController = new EventLogsController(_dbContext, _repo);

            IActionResult userEventLogs = await eventLogController.GetUserEventLog(2);

            OkObjectResult  intermediate = userEventLogs as OkObjectResult;
            List <EventLog> result       = intermediate.Value as List <EventLog>;

            // Assert
            Assert.True(result.Count == 0);
        }
示例#2
0
        public async void GetAllEventLogsTest()
        {
            var eventLogController = new EventLogsController(_dbContext, _repo);

            IActionResult allEventLogs = await eventLogController.GetAllEventLogs();

            OkObjectResult  intermediate = allEventLogs as OkObjectResult;
            List <EventLog> result       = intermediate.Value as List <EventLog>;

            // Assert
            Assert.True(result.Count == 2);
        }
示例#3
0
        public async void GetMyEventLogsNotLoggedInTest()
        {
            var eventLogController = new EventLogsController(_dbContext, _repo);


            IActionResult userEventLogs = await eventLogController.GetMyEventLogs(1);

            StatusCodeResult status = userEventLogs as StatusCodeResult;
            var result = new StatusCodeResult(401);

            // Assert
            Assert.True(status.StatusCode == result.StatusCode);
        }
示例#4
0
        public async void GetUserEventLogsReturnsTwoTest()
        {
            var eventLogController = new EventLogsController(_dbContext, _repo);

            var user = _dbContext.Users.FirstAsync(x => x.Id == 1);

            IActionResult userEventLogs = await eventLogController.GetUserEventLog(user.Id);

            OkObjectResult  intermediate = userEventLogs as OkObjectResult;
            List <EventLog> result       = intermediate.Value as List <EventLog>;

            // Assert
            Assert.True(result.Count == 2);
        }