Getting started with xunit

Other topics

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.

Installation and Setup (Getting Started)

Getting started with xUnit.net, on Platform:

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

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;
        }
    }
}

Contributors

Topic Id: 9974

Example Ids: 30651,30758

This site is not affiliated with any of the contributors.