TomJ
TomJ

Reputation: 5479

Second Unit Test Not Running

I am having trouble getting my Method B test to run. The logic is fine, but when the unit tests are run, only Method A will run. If Method A and B are switched in terms of spots, only Method B will run. So clearly the code is wrong at some point. Do I need to call method B's test from inside method A in order to get both unit tests to run?

I'm pretty new to C#, so forgive my basic question.

using redacted;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace UnitTests
{
    [TestClass()]
    public class ClassTest
    {
        public TestContext TestContext{get;set;}

        [TestMethod()]
        public void MethodATest()
        {
            the unit test
        }

        [TestMethod()]
        public void MethodBTest()
        {
            the unit test
        }
    }
}

Upvotes: 1

Views: 1811

Answers (1)

Alexei Levenkov
Alexei Levenkov

Reputation: 100545

Looks fine.

Make sure you are running all test (Test->Run->All tests), not something like test in context (Ctrl+R, T) or have some sort of list of tests to run.

Upvotes: 2

Related Questions