示例#1
0
        public async void RestaurantsController_GetRestaurants_CallsServeLunchGetRestaurantsAsync()
        {
            // Arrange
            Mock <IServeLunch> mockLunch = new Mock <IServeLunch>();

            mockLunch.Setup(s => s.GetRestaurantsAsync(It.IsAny <string>())).ReturnsAsync(new List <RestaurantDto>());
            var target = new RestaurantsController(mockLunch.Object);
            var zip    = "38655";

            // Act
            var result = await target.GetRestaurantsForZip(zip);

            //Assert
            Assert.Equal((int)HttpStatusCode.OK, result.StatusCode);
            mockLunch.Verify(v => v.GetRestaurantsAsync(zip), Times.Once);
        }