public async Task TestGetCalendarItem() { using (var context = new BankCalendarContext(options)) { // Given CalendarItem calendaritem1 = context.CalendarItem.First(); // When CalendarController calendarController = new CalendarController(context); IActionResult result = await calendarController.GetCalendarItem(calendaritem1.ID) as IActionResult; // Then var okObjectResult = result as OkObjectResult; Assert.IsNotNull(okObjectResult); var model = okObjectResult.Value as CalendarItem; Assert.IsNotNull(model); Assert.AreEqual(calendaritem1.Event, model.Event); } }