public async void Task_GetItems_Return_OkResult() { //Arrange var controller = new TeaInventoryController(repository); //Act var data = await controller.GetItems(); //Assert Assert.IsType <OkObjectResult>(data.Result); }
public async void Task_GetItems_Return_BadRequestResult() { //Arrange var controller = new TeaInventoryController(repository); //Act var data = await controller.GetItems(); data = null; if (data != null) { //Assert Assert.IsType <BadRequestResult>(data.Result); } }
public async void Task_GetItems_MatchResult() { //Arrange var controller = new TeaInventoryController(repository); //Act var data = await controller.GetItems(); //Assert Assert.IsType <OkObjectResult>(data.Result); var okResult = data.Result.Should().BeOfType <OkObjectResult>().Subject; var tea = okResult.Value.Should().BeAssignableTo <List <TeaInventory> >().Subject; Assert.Equal("Orange Juice", tea[0].TeaName); Assert.Equal("Orange Tree", tea[0].TeaDescription); Assert.Equal("Mango Juice", tea[1].TeaName); Assert.Equal("Mango Tree", tea[1].TeaDescription); }