/// <summary>Construct an instance of the class under test with dummy test doubles</summary> /// <typeparam name="T">Class to create</typeparam> /// <returns>Newly created test, populated with dummies, where applicable</returns> public virtual T BuildTarget <T>(IDoubleBuilder builder = null) where T : class { var myBuilder = new ConstructorDependencyBuilder(typeof(T).GetConstructors(), builder); //Null builder is fine here - the dependency builder will default to dummy var myDependencies = myBuilder.GetDependencyDoubles(); return((T)Activator.CreateInstance(typeof(T), myDependencies.ToArray())); }
public void Returns_Empty_For_Type_With_Default_Constructor_And_Parameter_Constructor() { var myBuilder = new ConstructorDependencyBuilder(typeof(TwoConstructors).GetConstructors()); Assert.AreEqual<int>(0, myBuilder.GetDependencyDoubles().Count); }