xunitGetting started with xunit


Remarks

This section provides an overview of what xunit is, and why a developer might want to use it.

It should also mention any large subjects within xunit, and link out to the related topics. Since the Documentation for xunit is new, you may need to create initial versions of those related topics.

A simple test written with xUnit.net

using Xunit;

namespace MyFirstUnitTests
{
    public class TestClass
    {
        [Fact]
        public void PassingTest()
        {
            Assert.Equal(4, Add(2, 2));
        }

        [Fact]
        public void FailingTest()
        {
            Assert.Equal(5, Add(2, 2));
        }

        int Add(int x, int y)
        {
            return x + y;
        }
    }
}
 

Installation and Setup (Getting Started)

Getting started with xUnit.net, on Platform:

  • .NET Core / ASP.NET Core
  • Desktop CLR
  • Universal Windows Apps