public void BuildWithValidLifetime(DependencyLifetime lifetime) { var factory = new GenericFactory(_genericContract, _genericImplementation, lifetime); var dependency = factory.BuildDependency(_genericContract.MakeGenericType(typeof(int)), _engine); dependency.Lifetime.Should().Be(lifetime); }
public void BuildDependency(Type type) { var contract = _genericContract.MakeGenericType(type); var dependency = _factory.BuildDependency(contract, _engine); dependency.Implementation.Should().Be(_genericImplementation.MakeGenericType(type)); }
public void BuildWithoutImplementation(Type type) { var factory = new GenericFactory(_genericImplementation, null, DependencyLifetime.Singleton); var contract = _genericImplementation.MakeGenericType(type); factory.Applicable(contract).Should().BeTrue(); var dependency = factory.BuildDependency(contract, _engine); dependency.Implementation.Should().Be(contract); }