Shouldly
  • Overview
  • Contributing
  • Documentation
    • Getting Started
    • Configuration
    • Equality
      • ShouldBe
      • NotBe
      • Null
      • Bool
      • Flags
      • AssignableTo
      • OfType
      • OneOf
      • Greater/Less Than
      • InRange
      • MatchApproved
      • Enumerable
      • SameAs
      • String
      • ExampleClasses
    • String
      • ShouldBe
      • Match
      • Contain
      • Null and Empty
      • StartWith
      • EndWith
    • Enumerable
      • ShouldBe
      • All
      • Empty
      • OneOf
      • Contain
      • Unique
      • SubsetOf
      • Have
    • Dictionary
      • ContainKey
      • ContainKeyAndValue
    • Exceptions
      • Throw
      • NotThrow
    • SatisfyAllConditions
    • CompleteIn
    • DynamicShould
    • Upgrade 3 to 4
Powered by GitBook
On this page
Edit on GitHub
  1. Documentation
  2. Equality

ExampleClasses

The classes used in these samples are:

namespace Simpsons;

public abstract class Pet
{
    public abstract string? Name { get; set; }

    public override string? ToString() => Name;
}

public class Cat : Pet
{
    public override string? Name { get; set; }
}

public class Dog : Pet
{
    public override string? Name { get; set; }
}

public class Person
{
    public Person()
    {
    }

    public Person(string name)
    {
        Name = name ?? throw new ArgumentNullException(nameof(name));
    }

    public string? Name { get; set; }
    public int Salary { get; set; }

    public override string? ToString() => Name;
}
PreviousStringNextString

Last updated 1 year ago

|

snippet source
anchor