Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
        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);
            }
        }