Ejemplo n.º 1
0
        public void PrinterShouldWorkCorrect_WhenEqualsAndGetHashMethodsOverriden()
        {
            var foo = new FooWithEquals {
                Name = "Hello", Next = new FooWithEquals {
                    Name = "Hello"
                }
            };
            var printer = ObjectPrinter.For <FooWithEquals>();
            var actual  = printer.PrintToString(foo);

            actual.Should().Be($"FooWithEquals{Environment.NewLine}" +
                               $"\tName = Hello{Environment.NewLine}" +
                               $"\tNext = FooWithEquals{Environment.NewLine}" +
                               $"\t\tName = Hello{Environment.NewLine}" +
                               $"\t\tNext = null{Environment.NewLine}");
        }
Ejemplo n.º 2
0
 protected bool Equals(FooWithEquals other) => Name == other.Name;