public void EqualsReturnsCorrectResult( bool typeResult, bool nameResult, bool expected) { var parameter = typeof(string).GetMethod("Contains").GetParameters().First(); var typeCriterion = new DelegatingCriterion <Type> { OnEquals = t => { Assert.Equal(parameter.ParameterType, t); return(typeResult); } }; var nameCriterion = new DelegatingCriterion <string> { OnEquals = n => { Assert.Equal(parameter.Name, n); return(nameResult); } }; var sut = new ParameterTypeAndNameCriterion( typeCriterion, nameCriterion); var actual = sut.Equals(parameter); Assert.Equal(expected, actual); }
public void EqualsReturnsCorrectResult( bool typeResult, bool nameResult, bool expected) { var parameter = typeof(string).GetMethod("Contains").GetParameters().First(); var typeCriterion = new DelegatingCriterion<Type> { OnEquals = t => { Assert.Equal(parameter.ParameterType, t); return typeResult; } }; var nameCriterion = new DelegatingCriterion<string> { OnEquals = n => { Assert.Equal(parameter.Name, n); return nameResult; } }; var sut = new ParameterTypeAndNameCriterion( typeCriterion, nameCriterion); var actual = sut.Equals(parameter); Assert.Equal(expected, actual); }
public void SutIsParameterInfoEquatable() { var sut = new ParameterTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); Assert.IsAssignableFrom<IEquatable<ParameterInfo>>(sut); }
public void SutIsParameterInfoEquatable() { var sut = new ParameterTypeAndNameCriterion( new DelegatingCriterion <Type>(), new DelegatingCriterion <string>()); Assert.IsAssignableFrom <IEquatable <ParameterInfo> >(sut); }
public void SutDoesNotEqualNullParameterInfo() { var sut = new ParameterTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); var actual = sut.Equals((ParameterInfo)null); Assert.False(actual, "SUT shouldn't equal null parameter."); }
public void SutDoesNotEqualNullParameterInfo() { var sut = new ParameterTypeAndNameCriterion( new DelegatingCriterion <Type>(), new DelegatingCriterion <string>()); var actual = sut.Equals((ParameterInfo)null); Assert.False(actual, "SUT shouldn't equal null parameter."); }
public void SutDoesNotEqualAnyObject(object other) { var sut = new ParameterTypeAndNameCriterion( 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 ParameterTypeAndNameCriterion( 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 ParameterTypeAndNameCriterion(typeCriterion, nameCriterion); var other = new ParameterTypeAndNameCriterion(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 ParameterTypeAndNameCriterion( typeCriterion, new DelegatingCriterion <string>()); var other = new ParameterTypeAndNameCriterion( 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 ParameterTypeAndNameCriterion(typeCriterion, nameCriterion); var other = new ParameterTypeAndNameCriterion(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 ParameterTypeAndNameCriterion( new DelegatingCriterion<Type>(), expected); IEquatable<string> actual = sut.NameCriterion; Assert.Equal(expected, actual); }
public void SutDoesNotEqualOtherWhenNameCriterionDiffers() { var typeCriterion = new DelegatingCriterion<Type>(); var sut = new ParameterTypeAndNameCriterion( typeCriterion, new DelegatingCriterion<string>()); var other = new ParameterTypeAndNameCriterion( 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 ParameterTypeAndNameCriterion( new DelegatingCriterion<Type>(), new DelegatingCriterion<string>()); var actual = sut.Equals(other); Assert.False(actual, "SUT should not equal object of other type."); }