コード例 #1
0
        public void RuntimeTypeWithExpression()
        {
            PersonRecordImmutable student = new StudentRecordImmutable
            {
                FirstName = "Damir",
                LastName  = "Arh",
            };

            var newStudent = student with {
                FirstName = "Damjan"
            };

            Assert.That(newStudent.GetType(), Is.EqualTo(typeof(StudentRecordImmutable)));
        }
    }
コード例 #2
0
        public void RuntimeTypeEquality()
        {
            PersonRecordImmutable person = new PersonRecordImmutable
            {
                FirstName = "Damir",
                LastName  = "Arh",
            };

            PersonRecordImmutable student = new StudentRecordImmutable
            {
                FirstName = "Damir",
                LastName  = "Arh",
            };

            Assert.That(person, Is.Not.EqualTo(student));
        }