public void EqualsReturnsCorrectResult( bool typeResult, bool nameResult, bool expected) { var field = typeof(string).GetField("Empty"); var typeCriterion = new DelegatingCriterion <Type> { OnEquals = t => { Assert.Equal(field.FieldType, t); return(typeResult); } }; var nameCriterion = new DelegatingCriterion <string> { OnEquals = n => { Assert.Equal(field.Name, n); return(nameResult); } }; var sut = new FieldTypeAndNameCriterion( typeCriterion, nameCriterion); var actual = sut.Equals(field); Assert.Equal(expected, actual); }
public void EqualsReturnsCorrectResult( bool typeResult, bool nameResult, bool expected) { var field = typeof(string).GetField("Empty"); var typeCriterion = new DelegatingCriterion<Type> { OnEquals = t => { Assert.Equal(field.FieldType, t); return typeResult; } }; var nameCriterion = new DelegatingCriterion<string> { OnEquals = n => { Assert.Equal(field.Name, n); return nameResult; } }; var sut = new FieldTypeAndNameCriterion( typeCriterion, nameCriterion); var actual = sut.Equals(field); Assert.Equal(expected, actual); }
public void SutIsFieldInfoEquatable() { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); Assert.IsAssignableFrom<IEquatable<FieldInfo>>(sut); }
public void SutIsFieldInfoEquatable() { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion <Type>(), new DelegatingCriterion <string>()); Assert.IsAssignableFrom <IEquatable <FieldInfo> >(sut); }
public void SutDoesNotEqualNullFieldInfo() { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); var actual = sut.Equals((FieldInfo)null); Assert.False(actual, "SUT shouldn't equal null field."); }
public void SutDoesNotEqualNullFieldInfo() { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion <Type>(), new DelegatingCriterion <string>()); var actual = sut.Equals((FieldInfo)null); Assert.False(actual, "SUT shouldn't equal null field."); }
public void SutDoesNotEqualAnyObject(object other) { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion <Type>(), new DelegatingCriterion <string>()); var actual = sut.Equals(other); Assert.False(actual, "SUT should not equal object of other type."); }
public void NameCriterionIsCorrect() { var expected = new DelegatingCriterion <string>(); var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion <Type>(), expected); IEquatable <string> actual = sut.NameCriterion; Assert.Equal(expected, actual); }
public void SutEqualsIdenticalValue() { var typeCriterion = new DelegatingCriterion <Type>(); var nameCriterion = new DelegatingCriterion <string>(); var sut = new FieldTypeAndNameCriterion(typeCriterion, nameCriterion); var other = new FieldTypeAndNameCriterion(typeCriterion, nameCriterion); var actual = sut.Equals(other); Assert.True(actual, "Expected structural equality to hold."); }
public void SutDoesNotEqualOtherWhenNameCriterionDiffers() { var typeCriterion = new DelegatingCriterion <Type>(); var sut = new FieldTypeAndNameCriterion( typeCriterion, new DelegatingCriterion <string>()); var other = new FieldTypeAndNameCriterion( typeCriterion, new DelegatingCriterion <string>()); var actual = sut.Equals(other); Assert.False( actual, "SUT should not equal other when name criterion differs."); }
public void SutEqualsIdenticalValue() { var typeCriterion = new DelegatingCriterion<Type>(); var nameCriterion = new DelegatingCriterion<string>(); var sut = new FieldTypeAndNameCriterion(typeCriterion, nameCriterion); var other = new FieldTypeAndNameCriterion(typeCriterion, nameCriterion); var actual = sut.Equals(other); Assert.True(actual, "Expected structural equality to hold."); }
public void NameCriterionIsCorrect() { var expected = new DelegatingCriterion<string>(); var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion<Type>(), expected); IEquatable<string> actual = sut.NameCriterion; Assert.Equal(expected, actual); }
public void SutDoesNotEqualOtherWhenNameCriterionDiffers() { var typeCriterion = new DelegatingCriterion<Type>(); var sut = new FieldTypeAndNameCriterion( typeCriterion, new DelegatingCriterion<string>()); var other = new FieldTypeAndNameCriterion( typeCriterion, new DelegatingCriterion<string>()); var actual = sut.Equals(other); Assert.False( actual, "SUT should not equal other when name criterion differs."); }
public void SutDoesNotEqualAnyObject(object other) { var sut = new FieldTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); var actual = sut.Equals(other); Assert.False(actual, "SUT should not equal object of other type."); }