public void FulfillWithNull() { // Setup var dependency = new Dependency(typeof(Dependency1)); // Execute dependency.Fulfill(a_service: null); }
public void ConstructDepencency() { // Execute var dependency = new Dependency(a_contract: typeof (Dependency1)); // Assert Assert.AreSame(typeof(Dependency1), dependency.Contract); }
public void CheckIfFulfilledWhenNot() { // Setup var dependency = new Dependency(typeof (Dependency2)); // Assert Assert.IsFalse(dependency.IsFulfilled); }
public void FulfillWithService() { // Setup var container = new Container(); var service = new Service(container, typeof(Dependency1), typeof(DependencyBase), null); var dependency = new Dependency(typeof (Dependency1)); // Execute dependency.Fulfill(a_service: service); // Assert Assert.IsTrue(dependency.IsFulfilled); }
public void FulfillWithContainer() { // Setup var container = new Container(); container.Register<DependencyBase, Dependency2>(); var dependency = new Dependency(typeof(DependencyBase)); // Execute dependency.Fulfill(a_container: container); // Assert Assert.IsTrue(dependency.IsFulfilled); }
/// <summary> /// Constructor. /// </summary> /// <param name="a_instanceServiceService">Instance.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="a_instanceServiceService"/> is null.</exception> public InstanceFactory(InstanceService a_instanceServiceService) { #region Argument Validation if (a_instanceServiceService == null) throw new ArgumentNullException(nameof(a_instanceServiceService)); #endregion _instanceService = a_instanceServiceService; DependencyComplexity = 0; Dependencies = new Dependency[0]; CanCreate = true; }
public void FulfillWithServiceOfWrongType() { // Setup var container = new Container(); var service = new Service(container, typeof(Dependency2), typeof(DependencyBase), null); var dependency = new Dependency(typeof (Dependency1)); // Execute dependency.Fulfill(a_service: service); }
public void ResolveFulfilledDependency() { // Setup var container = new Container(); container.Register<DependencyBase, Dependency2>(); var dependency = new Dependency(typeof(DependencyBase)); dependency.Fulfill(a_container: container); // Execute var instance = dependency.Resolve(); // Assert Assert.IsTrue(dependency.IsFulfilled); }