public void BuilderIsCorrect() { var builder = new Fixture(); var sut = new ParameterToFieldComparer(builder); var actual = sut.Builder; Assert.Same(builder, actual); }
public void EqualsParameterToNonFieldReturnsFalse() { var sut = new ParameterToFieldComparer(new Fixture()); var parameterInfoElement = Constructors.Select(() => new ClassWithMembers(0)) .GetParameters().First().ToElement(); var nonFieldInfoElement = GetType().ToElement(); var actual = sut.Equals(parameterInfoElement, nonFieldInfoElement); Assert.False(actual, "Not Equals."); }
public void EqualsParameterToFieldReturnsTrueWhenTheyHaveEqualValue() { var parameterInfoElement = Constructors.Select(() => new TypeForFieldEqualValue(0)) .GetParameters().First().ToElement(); var sut = new ParameterToFieldComparer(new Fixture()); var fieldInfoElement = new Fields<TypeForFieldEqualValue>() .Select(x => x.Value).ToElement(); var actual = sut.Equals(parameterInfoElement, fieldInfoElement); Assert.True(actual, "Equals."); }
public void EqualsNonParameterToFieldReturnsFalse() { var sut = new ParameterToFieldComparer(new Fixture()); var nonParameterInfoElement = GetType().ToElement(); var fieldInfoElement = new Fields<ClassWithMembers>() .Select(x => x.PublicField) .ToElement(); var actual = sut.Equals(nonParameterInfoElement, fieldInfoElement); Assert.False(actual, "Not Equals."); }
public void EqualsParameterToFieldReturnsFalseWhenParameterIsFromNonConstructor() { var sut = new ParameterToFieldComparer(new Fixture()); var parameterInfoElement = new Methods<TypeForFieldEqualValue>() .Select(x => x.Mehtod(null)) .GetParameters().First().ToElement(); var fieldInfoElement = new Fields<ClassWithMembers>() .Select(x => x.PublicField).ToElement(); var actual = sut.Equals(parameterInfoElement, fieldInfoElement); Assert.False(actual, "Not Equals."); }
public void EqualsParameterToFieldReturnsFalseWhenTheyRepresentDifferentReflectedTypes() { var sut = new ParameterToFieldComparer(new Fixture()); var parameterInfoElement = Constructors.Select(() => new TypeForFieldEqualValue(0)) .GetParameters().First().ToElement(); var fieldInfoElement = new Fields<ClassWithMembers>() .Select(x => x.PublicField).ToElement(); var actual = sut.Equals(parameterInfoElement, fieldInfoElement); Assert.False(actual, "Not Equals."); }
public void GetHashCodeReturnsAlwaysZero() { var sut = new ParameterToFieldComparer(new Fixture()); var actual = sut.GetHashCode(null); Assert.Equal(0, actual); }
public void EqualsParameterToFieldAlwaysReturnsFalseWhenConstructorThrows() { var parameterInfoElement = Constructors .Select(() => new TypeForFieldEqualValue(default(object))) .GetParameters().Single().ToElement(); var sut = new ParameterToFieldComparer(new Fixture()); var fieldInfoElement = new Fields<TypeForFieldEqualValue>() .Select(x => x.Value).ToElement(); var actual = sut.Equals(parameterInfoElement, fieldInfoElement); Assert.False(actual); }
public void SutIsEqualityComparer() { var sut = new ParameterToFieldComparer(new Fixture()); Assert.IsAssignableFrom<IEqualityComparer<IReflectionElement>>(sut); }