Esempio n. 1
0
        public void GetAllBookings_WhenDatabaseIsEmpty_ReturnEmpty(int expectedStatusCode)
        {
            _mockService.Setup(s => s.GetAllBookings()).Returns(Task.FromResult(new List <Booking>().AsQueryable()));
            var response = _controller.GetAllBookings().GetAwaiter().GetResult();

            // Assert
            var result = response.Result as ObjectResult;

            Assert.That(result.StatusCode == expectedStatusCode);
            Utilities.PrintOut(response);
        }
Esempio n. 2
0
 public void Test_GetAllBookings()
 {
     //Arrange
     try
     {
         var            result = bookingsController.GetAllBookings();
         List <Booking> bookings;
         result.TryGetContentValue <List <Booking> >(out bookings);
         Assert.IsTrue(bookings.Count > 0);
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }