Created
October 25, 2020 00:05
-
-
Save xximjasonxx/7c2252fc91b68804788e93bd3c8e7751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class given_an_instance_of_test_controller | |
{ | |
[Fact] | |
public void assert_that_the_name_query_string_parameter_is_returned_in_the_result() | |
{ | |
// arrange | |
var contextMock = new Mock<IContextAccessor>(); | |
contextMock.Setup(x => x.QueryString).Returns(new Dictionary<string, string> { { "name", "TestUser" } }); | |
var controller = new TestController(contextMock.Object); | |
// act | |
var result = controller.Get() as OkObjectResult; | |
// assert | |
Assert.Equal("TestUser", result.Value.ToString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment