Example #1
0
 public void CreatePerson()
 {
     person = new Person {
         Name = "Alex", Height = 175, Age = 19
     };
     personForTests = new PersonForTests {
         Name = "Alex", Height = 175, Age = 19
     };
 }
Example #2
0
        public void ShouldСonsiderNestingLevel_IfNestingLevelMoreThanFive()
        {
            var currentParent = personForTests;

            for (var i = 0; i < 6; i++)
            {
                var newPerson = new PersonForTests {
                    Name = "Alex", Height = 175 + i + 1, Age = 19
                };
                newPerson.Parent = currentParent;
                currentParent    = newPerson;
            }
            var printingResult = currentParent.PrintToString();

            printingResult.Should().Contain("Nesting level is exceeded");
        }
Example #3
0
        public void ShouldReturnCorrectResult_IfDictionaryHaveReferenceTypeKeysAndValues()
        {
            var secondPersonForTests = new PersonForTests {
                Name = "Albert", Age = 25, Height = 185
            };
            var collection = new Dictionary <PersonForTests, PersonForTests>
            {
                { personForTests, secondPersonForTests },
                { secondPersonForTests, personForTests }
            };
            var printingResult = collection.PrintToString();

            printingResult.Should().Contain("Dictionary")
            .And.Contain(
                "\tKey 0: PersonForTests\r\n\t\tName = Alex\r\n\t\tHeight = 175\r\n\t\tParent = null\r\n\t\tAge = 19\r\n")
            .And.Contain(
                "\tValue 0: PersonForTests\r\n\t\tName = Albert\r\n\t\tHeight = 185\r\n\t\tParent = null\r\n\t\tAge = 25\r\n")
            .And.Contain(
                "\tKey 1: PersonForTests\r\n\t\tName = Albert\r\n\t\tHeight = 185\r\n\t\tParent = null\r\n\t\tAge = 25\r\n")
            .And.Contain(
                "\tValue 1: PersonForTests\r\n\t\tName = Alex\r\n\t\tHeight = 175\r\n\t\tParent = null\r\n\t\tAge = 19\r\n");
        }