locked
Use of xUnit in .Net Core RRS feed

  • Question

  • User-1439110336 posted

    Hi, 

    I created project to perform unit test with xUnit, and I want to perform simple test that I could check it's all ok. When I'm running this test I got  view as below. I think should be light on green. 

    [Fact]
    
    public void PassingTest()
        {
            Assert.Equal(4, Add(2, 2));
        }
    public int Add(int x, int y)
         {
            return x + y;
         }

    
    

    Thursday, October 24, 2019 9:22 AM

All replies

  • User1120430333 posted

    To me, the test should be like this.

    public void PassingTest()
        {
            var result = Add(2, 2);
            Assert.Equal(4, result);
        }

    Thursday, October 24, 2019 2:06 PM
  • User-1439110336 posted

    Problem was solved, just I need installed xunit.runner.visualstudio. I thought that when I installed xunit this package has also installed. 

    Thursday, October 24, 2019 5:11 PM