Skip to content

weitzhandler/fluentassertions.json

 
 

Repository files navigation

"With Fluent Assertions, the assertions look beautiful, natural and most importantly, extremely readable" (by Girish)

Available extension methods

  • BeEquivalentTo()
  • ContainSingleElement()
  • ContainSubtree()
  • HaveCount()
  • HaveElement()
  • HaveValue()
  • MatchRegex()
  • NotBeEquivalentTo()
  • NotHaveElement()
  • NotHaveValue()
  • NotMatchRegex()

See "in-code" description for more information.

Usage

Be sure to include using FluentAssertions.Json; otherwise false positives may occur.

using FluentAssertions;
using FluentAssertions.Json;
using Newtonsoft.Json.Linq;

... 
var actual = JToken.Parse(@"{ ""key1"" : ""value"" }");
var expected = JToken.Parse(@"{ ""key2"" : ""value"" }");
actual.Should().BeEquivalentTo(expected);

About

NewtonSoft.Json extensions for FluentAssertions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 96.9%
  • PowerShell 1.7%
  • Shell 1.3%
  • Batchfile 0.1%