xunit

Getting 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.

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

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow