Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.