Skip to content

Instantly share code, notes, and snippets.

@rubenrorije
Created December 30, 2018 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubenrorije/2caf183ffb7e598546d220797252795c to your computer and use it in GitHub Desktop.
Save rubenrorije/2caf183ffb7e598546d220797252795c to your computer and use it in GitHub Desktop.
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FluentAssertion.Tests
{
[TestClass]
public class FluentAssertionTests
{
[TestMethod]
public void Trailing_Backslash_In_Expected_Result_Should_Not_Be_Removed()
{
"A".Should().Be("A\\");
/*
* Output:
* Expected string to be "A" with a length of 2, but "A" has a length of 1, differs near "A" (index 0).
* Expected Output:
* Expected string to be "A\" with a length of 2, but "A" has a length of 1, differs near "A" (index 0).
*/
}
[TestMethod]
public void MyTestMethod()
{
"A".Should().Be("AB");
}
[TestMethod]
public void Trailing_Backslash_In_Subject_Should_Not_Be_Removed()
{
"A\\".Should().Be("A");
/*
* Output:
* Expected string to be "A" with a length of 1, but "A\" has a length of 2, differs near "" (index 1).
* Expected Output:
* Expected string to be "A" with a length of 1, but "A\" has a length of 2, differs near "\" (index 1).
*/
}
[TestMethod]
public void Literal_Backslash_Followed_By_R_Is_Not_Escaped_In_Expected_Result()
{
"\\r".Should().Be("r");
/*
* Output:
Expected string to be "r" with a length of 1, but "
" has a length of 2, differs near "
" (index 0).
* Expected output:
* Expected string to be "r" with a length of 1, but "\r" has a length of 2, differs near "\" (index 0).
*/
}
[TestMethod]
public void Literal_Backslash_Followed_By_R_Is_Not_Escaped_In_Subject()
{
"r".Should().Be("\\r");
/*
* Output: Expected string to be "
" with a length of 2, but "r" has a length of 1, differs near "r" (index 0).
* Expected output:
* Expected string to be "\r" with a length of 2, but "r" has a length of 1, differs near "r" (index 0).
*/
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment