Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.61 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.61 KB

Xunit.Extension

XUnit test Extension.

Added functionalites

  1. Subclass of trait attributes to mark tests as Unit, Acceptance and Integration Test.
  2. Subclass of Fact and theory sentence attribute [FactSentence] and [TheorySentence] are added to increase readability. On test explorer, test name will display with spaces and arrow (after test class name).
  3. Equality test. Original equality test code is copied from the pluralsight course 'Improving Testability Through Design' by Zoran Horvat; and changed to work with XUnit

How to use

Please check the sample.

Example

using Xunit;
using Xunit.Extension.Equality;
using Xunit.Extension.TraitAttributes;

namespace XUnit.Extension.Sample
{
    [UnitTest]
    public class EqualityTest
    {
        [TheorySentence]
        [InlineData("first ", "second")]
        [InlineData(" first", " second")]
        [InlineData(" first", "second")]
        [InlineData("first", "second ")]
        public void ValueObject_TrimTest(string value1MayContainSpaces, string value2MayContainSpaces)
        {
            EqualityTests
                .For(new SimpleValueObject("first", "second"))
                .EqualTo(new SimpleValueObject(value1MayContainSpaces, value2MayContainSpaces))
                .Assert();
        }
    }
}

Result

alt testwindow

FAQ:

  • I have added [FactSentence] but still displaying without spaces

--> Please close and open the solution