public void HashCode_DifferentObjectsDifferentPropertyWhichWillBeChecked_DifferentHashCode()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().With(m => m.Prop1).Compile();
     var fooBuilder = FooBuilder.AFoo().WithDummyProp2();
     var foo1 = fooBuilder.WithProp1(ONE).Build();
     var foo2 = fooBuilder.WithProp1(TWO).Build();
     Assert.AreNotEqual(hashCodeBuilder.HashCode(foo1), hashCodeBuilder.HashCode(foo2));
 }
 public void HashCode_DifferentObjectsSamePropertiesOnlyOnePropertyChecked_SameHashCode()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().With(m => m.Prop1).Compile();
     var fooBuilder = FooBuilder.AFoo().WithFullDummyData();
     var foo1 = fooBuilder.Build();
     var foo2 = fooBuilder.Build();
     Assert.AreEqual(hashCodeBuilder.HashCode(foo1), hashCodeBuilder.HashCode(foo2));
 }
 public void HashCode_DifferentObjectsDifferentProperties_DifferentHashCode()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic().Compile();
     var fooBuilder = FooBuilder.AFoo().WithDummyProp2();
     var foo1 = fooBuilder.WithProp1(ONE).Build();
     var foo2 = fooBuilder.WithProp1(TWO).Build();
     Assert.AreNotEqual(hashCodeBuilder.HashCode(foo1), hashCodeBuilder.HashCode(foo2));
 }
 public void HashCode_DifferentObjectsSamePropertiesWithNullObject_SameHashCode()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic().Compile();
     var fooBuilder = FooBuilder.AFoo().WithDummyProp2();
     var foo1 = fooBuilder.Build();
     var foo2 = fooBuilder.Build();
     Assert.AreEqual(hashCodeBuilder.HashCode(foo1), hashCodeBuilder.HashCode(foo2));
 }
 public void HashCode_UncompiledBuilder_Exception()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic();
     var fooBuilder = FooBuilder.AFoo().WithFullDummyData();
     var foo1 = fooBuilder.Build();
     hashCodeBuilder.HashCode(foo1);
 }
 public void HashCode_NullParameter_Exception()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic().Compile();
     Assert.AreEqual(0, hashCodeBuilder.HashCode(null));
 }
 public void HashCode_SameObjects_SameHashCode()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic().Compile();
     var foo = FooBuilder.AFoo().WithFullDummyData().Build();
     Assert.AreEqual(hashCodeBuilder.HashCode(foo), hashCodeBuilder.HashCode(foo));
 }
 public void HashCode_WrongType_Exception()
 {
     var hashCodeBuilder = new HashCodeBuilder<Foo>().WithAllPublic().Compile();
     var fooBuilder = FooBuilder.AFoo().WithFullDummyData();
     var foo1 = fooBuilder.Build();
     hashCodeBuilder.HashCode(String.Empty);
 }