public void PrintToString_ContainsNotExcludedTypes_WhenExcludingIsHappened()
        {
            var printing = printer.Excluding <int>()
                           .PrintToString(person);

            GetPropertiesWithNotCurrentType <int>(person)
            .Should()
            .OnlyContain(x => printing.Contains(x.Name));
        }
Exemple #2
0
        public void ExcludeTypes_BySelector()
        {
            var expectedResult =
                $"Person{newLine}	Id = 00000000-0000-0000-0000-000000000000{newLine}	Name = Alexander{newLine}	Age = 19{newLine}";

            printer
            .Excluding <double>()
            .PrintToString(person)
            .Should().Be(expectedResult);
        }
        public void ObjectPrinter_ShouldExcludeTypeFromSerialization()
        {
            var expected = string.Join(Environment.NewLine, "Person", "\tId = 00000000-0000-0000-0000-000000000000",
                                       "\tName = John Smith", "\tHeight = 13,37")
                           + Environment.NewLine;

            personPrinter.Excluding <int>();

            personPrinter.PrintToString(person).Should().Be(expected);
        }
Exemple #4
0
        public void ExcludeFields_ByGivenSelector()
        {
            var result = $"Person{_newLine}\tName = Legion{_newLine}\tHeight = 160{_newLine}\tAge = 13{_newLine}"
                         .ToHashSet(_newLine);

            _printer.Excluding(p => p.Id)
            .PrintToString(_person)
            .ToHashSet(_newLine)
            .Should()
            .BeEquivalentTo(result);
        }
        public void ObjectPrinter_WithExcludingType_ReturnRightResult()
        {
            printer.Excluding <Guid>();
            var result         = printer.PrintToString(testPerson);
            var expectedResult = new StringBuilder()
                                 .Append("Person\r\n")
                                 .Append("\tName = Phil\r\n")
                                 .Append("\tHeight = 190\r\n")
                                 .Append("\tAge = 22\r\n")
                                 .ToString();

            result.Should().BeEquivalentTo(expectedResult);
        }
Exemple #6
0
 public void ExcludingType_DoNotPrintStrings_On()
 {
     printer.Excluding <string>();
     printer.PrintToString(Me).Should()
     .NotContain("Name = Natasha")
     .And.NotContain("Name = Anthony")
     .And.NotContain("Surname = Smit");
 }
 public void ObjectPrinter_ExcludeHeight_DefaultPersonWithoutHeight()
 {
     printer.Excluding(person => person.Height).PrintToString(new Person()).Should().Be(
         string.Join(NewLine + '\t', "Person", "Id = 00000000-0000-0000-0000-000000000000",
                     "Name = null", "Age = 0", "OtherPerson = null"));
 }
Exemple #8
0
 public void PrintToString_NotPrintingType_IfTypeExcluded()
 {
     printer = printer.Excluding <int>();
     printer.PrintToString(person).Should().NotContain(nameof(person.Age));
 }
Exemple #9
0
 public void ShouldExcludeTypes()
 {
     printingConfig.Excluding <double>();
     printingConfig.Config.ExcludedTypes.Should().Contain(typeof(double));
 }
        public void ObjectPrinter_FieldSerialization_CanBeExcluded()
        {
            var line = _printer.Excluding(p => p.NickName).PrintToString(_person);

            line.Should().NotContain("commonNickName");
        }