Exemple #1
0
        public T Apply(InstanceGenerator instanceGenerator, GenerationTrace trace)
        {
            try
            {
                return(_valueGenerator.Value <T>());
            }
            catch (ThirdPartyGeneratorFailed e)
            {
                trace.ThirdPartyGeneratorFailedTryingFallback(e);

                return(_fallbackTypeGenerator.GenerateInstance(instanceGenerator, trace));
            }
            catch (TargetInvocationException e)
            {
                if (Debugger.IsAttached)
                {
                    Console.WriteLine(e);
                }
                return(_fallbackTypeGenerator.GenerateInstance(instanceGenerator, trace));
            }
        }
Exemple #2
0
 public T Apply(InstanceGenerator instanceGenerator)
 {
     try
     {
         return(_valueGenerator.Value <T>());
     }
     catch (AutoFixture.ObjectCreationException e)
     {
         if (Debugger.IsAttached)
         {
             Console.WriteLine(e);
         }
         return(_fallbackTypeGenerator.GenerateInstance(instanceGenerator));
     }
     catch (TargetInvocationException e)
     {
         if (Debugger.IsAttached)
         {
             Console.WriteLine(e);
         }
         return(_fallbackTypeGenerator.GenerateInstance(instanceGenerator));
     }
 }
Exemple #3
0
 public T Apply(InstanceGenerator instanceGenerator, GenerationTrace trace)
 {
     return(_valueGenerator.Value <T>());
 }
Exemple #4
0
 public T Apply(InstanceGenerator instanceGenerator)
 {
     return(_valueGenerator.Value <T>());
 }
 public object Apply(InstanceGenerator instanceGenerator, GenerationRequest request, Type type)
 {
     return(_valueGenerator.Value(type, instanceGenerator, request));
 }