public async Task TestGetAllHotels() { ActionResult <IEnumerable <Hotel> > response = await _controller.Get(); var result = response.Result as OkObjectResult; var data = result.Value; Assert.IsNotNull(result); Assert.AreEqual(result.StatusCode, (int)HttpStatusCode.OK); Assert.AreEqual(data, this.Hotels); }
public async void Test_Flight_Controller_GetAsync_ShouldBeOk() { //arrange int expectedCount = 1; List <Hotel> hotels = new List <Hotel>() { HotelBuilder.Start().Build() }; _fakeMediator.Setup(mdtr => mdtr.Send(It.IsAny <HotelLoadAllQuery>(), It.IsAny <CancellationToken>())) .ReturnsAsync(hotels); //action var callback = await _controller.Get(); //assert var response = callback.Should().BeOfType <List <Hotel> >().Subject; response.Count.Should().Be(expectedCount); }
public void Get_InvalidLocationId_EmptyListReturned() { var result = _hotelsController.Get(0); Assert.AreEqual(0, result.Value.Count()); }