Exemplo n.º 1
0
        public void SetFormatForNestedProperty_Correctly()
        {
            Func <string, string> materialFormatter = (n) => $"Semi-{n}";
            var expectedFormat =
                $"Sphere" + Environment.NewLine +
                $"\tRadius = {sphere.Radius}" + Environment.NewLine +
                $"\tMaterial = Material" + Environment.NewLine +
                $"\t\tName = {materialFormatter(sphere.Material.Name)}" + Environment.NewLine;

            var resultFormat = sphere.ConfigureFormat()
                               .ForProperty(s => s.Material.Name)
                               .SetFormat(n => materialFormatter(n))
                               .Print();

            resultFormat.Should().BeEquivalentTo(expectedFormat);
        }