Skip to content

Instantly share code, notes, and snippets.

Created October 25, 2020 00:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save xximjasonxx/7c2252fc91b68804788e93bd3c8e7751 to your computer and use it in GitHub Desktop.
public class given_an_instance_of_test_controller
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