0

I really have no experience with unit testing, but I have tried to implement a very simple one into my application and can't get it to run. I have a .NET Web API with a controller I would like to test. I have crated the following test class in a separate project, and referenced the API in it:

[TestClass]
class TestWebhookControllers
{
    [TestMethod]
    public void TestTest_ShouldReturn201()
    {
        var controller = new TestWebhookController();
        controller.Request = new HttpRequestMessage();
        controller.Configuration = new HttpConfiguration();

        var result = controller.Get();

        Assert.AreEqual(result.StatusCode, HttpStatusCode.Continue);
    }
}

When I click on run all tests, the build succeeds but nothing else happens. The Test Explorer is empty. There are no errors of any kind. I must be missing something basic.

1 Answer 1

5

I think you need to make the class public for it to be picked up

[TestClass]
public class TestWebhookControllers
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.