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); }
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); }
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); }
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); }