public void Factory_InstanceFactory_Same() { Factory.RemoveAllInjectors(); var instance = new DefaultImplementation { Value = 123 }; Factory.AddInjector(new InstanceInjector <DefaultImplementation>(instance)); var res = Factory.Get <DefaultImplementation>(); Assert.Same(res, instance); Assert.Equal(res, instance); }
public void Factory_FunctionFactory_NotSame() { Factory.RemoveAllInjectors(); var instance = new DefaultImplementation { Value = 123 }; Factory.AddInjector(new FunctionInjector <DefaultImplementation>(() => new DefaultImplementation { Value = 123 })); var res = Factory.Get <DefaultImplementation>(); Assert.NotSame(res, instance); Assert.Equal(res, instance); }