public T InstanceOf <T>(InlineGenerator <T> gen) { var trace = new ListBasedGenerationTrace(); try { trace.BeginCreatingInstanceGraphWithInlineGenerator(typeof(T), gen); return(gen.GenerateInstance(SynchronizedThis, trace)); } catch (Exception e) { throw new GenerationFailedException(trace, e); } }
public T Instance <T>() { var trace = new ListBasedGenerationTrace(); try { trace.BeginCreatingInstanceGraphWith(typeof(T)); return(Instance <T>(trace)); } catch (Exception e) { throw new GenerationFailedException(trace, e); } }
public T Instance <T>(params GenerationCustomization[] customizations) { var trace = new ListBasedGenerationTrace(); try { trace.BeginCreatingInstanceGraphWith(typeof(T)); return(_fakeChainFactory.GetInstance <T>().Resolve(new CustomizedGenerator(SynchronizedThis, customizations), trace)); } catch (Exception e) { throw new GenerationFailedException(trace, e); } }
public T Dummy <T>() { var trace = new ListBasedGenerationTrace(); try { trace.BeginCreatingDummyInstanceOf(typeof(T)); return(Dummy <T>(trace)); } catch (Exception e) { throw new GenerationFailedException(trace, e); } }