public void Should_return_expected_message_when_GetAll_successfully() { // given string expectedMessage = "a beauty tag"; var mockService = new Mock <ShowService>(null); mockService.Setup(service => service.GetShowLabel()) .Returns(expectedMessage); var showController = new ShowController(mockService.Object); // when ObjectResult actionResult = showController.GetAll() as ObjectResult; // then Assert.Equal(200, actionResult.StatusCode); Assert.Equal(expectedMessage, actionResult.Value); }
public void GetAll() { //Arrange string expectedMessage = "a beauty tag"; var mockService = new Mock <ShowService>(null); mockService.Setup(service => service.GetShowLabel()) .Returns(expectedMessage); var showController = new ShowController(mockService.Object); //Act ObjectResult actionResult = showController.GetAll() as ObjectResult; //Assert Assert.Equal(200, actionResult.StatusCode); Assert.Equal(expectedMessage, actionResult.Value); }
public async Task GetAllTest() { var result = await _controller.GetAll(); Assert.IsNotNull(result); }