示例#1
0
        private void GetRestaurantByIdTest()
        {
            RestaurantsController restaurantsController = CreateFakeRestaurantsController();

            //Retrieving existing restaurant
            var response = restaurantsController.GetRestaurantById(_restaurants[0].Id);

            Assert.IsType <OkObjectResult>(response.Result);
            Assert.Equal(_restaurants[0].Id, ((LocationRestaurantModel)((OkObjectResult)response.Result).Value).Id);

            //Retrieving non-existing restaurant
            response = restaurantsController.GetRestaurantById(0);
            Assert.IsType <NotFoundObjectResult>(response.Result);
        }