public void Equal_EnumerableSwap() { OtherFoo foo = new OtherFoo() { I1 = 42, I2 = 24 }; OtherFoo foo2 = new OtherFoo() { I1 = 24, I2 = 42 }; Assert.NotEqual(foo.GetHashCode(), foo2.GetHashCode()); }
public void ConditionalInstanceResolutionShouldResolveCorrectly() { var source1 = new Foo(); var source2 = new OtherFoo(); var registry = new Registry() .Define <IFoo>().Precondition(req => false).As(source1) .Define <IFoo>().Precondition(req => true).As(source2); using (var container = registry.CreateContainer()) { var foo = container.GetServices <IFoo>().Single(); Assert.Same(source2, foo); } }