Skip to content

Add 'message' parameter to Assertions. Nunit, Mstest, Xunit is supported.

License

Notifications You must be signed in to change notification settings

DaleStan/AssertMessage

 
 

Repository files navigation

Chat on Gitter NuGet Status

This is an add-in for Fody

Icon

Adds 'message' parameter to Assertions. It is generated from source code.

Supported frameworks:

  • Nunit
  • Mstest
  • Xunit

Introduction to Fody.

NuGet installation

Install the AssertMessage.Fody NuGet package and update the Fody NuGet package:

PM> Install-Package AssertMessage.Fody
PM> Update-Package Fody

The Update-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.

Add to FodyWeavers.xml

Add <AssertMessage/> to FodyWeavers.xml

<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
  <AssertMessage/>
</Weavers>

Your Code

public void CustomerTest()
{
    var expectedCustomer = new Customer();
    var actualCustomer = new Customer();
    ...
    Assert.AreEqual(expectedCustomer.Money, actualCustomer.Money);
}

What gets compiled

public void CustomerTest()
{
    var expectedCustomer = new Customer();
    var actualCustomer = new Customer();
    ...
    Assert.AreEqual(expectedCustomer.Money, actualCustomer.Money, "Assert.AreEqual(expectedCustomer.Money, actualCustomer.Money);");
}

Pdb files

The Pbd files are required for this plugin. To make it work in Release, please enable Debug Info(pdbonly) in Advanced Build Settings Dialog Box. More info

Icon

Message by Prerak Patel from The Noun Project

About

Add 'message' parameter to Assertions. Nunit, Mstest, Xunit is supported.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%