コード例 #1
0
 public void CompareProperties_SameNameDifferentAccessors_Equal()
 {
     // Arrange
     var type = Substitute.For<ITypeSymbol>();
     var property = new Property("p1", type, true, true);
     var otherProperty = new Property("p1", type, true, false);
     var comparer = new MemberComparer();
     // Act
     var equal = comparer.IsSameAs(property, otherProperty);
     // Assert
     Assert.IsTrue(equal);
 }
コード例 #2
0
        public void CompareProperties_SameNameDifferentTypes_Equal()
        {
            // Arrange
            var typeOfProperty = Substitute.For<ITypeSymbol>();
            var typeOfOtherProperty = Substitute.For<ITypeSymbol>();
            var property = new Property("p1", typeOfProperty, true, true);
            var otherProperty = new Property("p1", typeOfOtherProperty, true, true);
            var comparer = new MemberComparer();

            // Act
            var equal = comparer.IsSameAs(property, otherProperty);

            // First ensure that both types are different
            Assert.AreNotEqual(typeOfProperty, typeOfOtherProperty);
            // now ensure that the properties are the same even with different types
            Assert.IsTrue(equal);
        }