Exemple #1
0
        private static void Write(Exception ex, string messageFormat, params object[] messageArgs)
        {
            var writer = new DefaultOutputWriter(Console.Write);

            writer.Write(messageFormat, messageArgs);
            writer.WriteLine();
            using (writer.Indent())
            {
                writer.Write(ex.Message);
                writer.WriteLine();
            }
        }
Exemple #2
0
        private static void WarnFailedToGetSomeTypes(Assembly assembly, ReflectionTypeLoadException ex)
        {
            var writer = new DefaultOutputWriter(Console.Write);

            Write(
                writer,
                ex,
                $"Warning: FakeItEasy failed to get some types from assembly '{assembly}' while scanning for extension points. Some IArgumentValueFormatters, IDummyFactories, and IFakeOptionsBuilders in that assembly might not be available.");

            using (writer.Indent())
            {
                int notLoadedCount = ex.Types.Count(t => t == null);
                writer.Write($"{notLoadedCount} type(s) were not loaded for the following reasons:");
                writer.WriteLine();
                foreach (var loaderException in ex.LoaderExceptions)
                {
                    writer.Write(" - ");
                    writer.Write(loaderException.GetType());
                    writer.Write(": ");
                    writer.Write(loaderException.Message);
                    writer.WriteLine();
                }
            }
        }
 private static void Write(Exception ex, string messageFormat, params object[] messageArgs)
 {
     var writer = new DefaultOutputWriter(Console.Write);
     writer.Write(messageFormat, messageArgs);
     writer.WriteLine();
     using (writer.Indent())
     {
         writer.Write(ex.Message);
         writer.WriteLine();
     }
 }
 private static void WarnFailedToLoadAssembly(string assemblyFile, Exception e)
 {
     var outputWriter = new DefaultOutputWriter(Console.Write);
     outputWriter.Write(
         "Warning: FakeItEasy failed to load assembly '{0}' while scanning for extension points. Any IArgumentValueFormatters, IDummyDefinitions, and IFakeConfigurators in that assembly will not be available.",
         assemblyFile);
     outputWriter.WriteLine();
     using (outputWriter.Indent())
     {
         outputWriter.Write(e.Message);
         outputWriter.WriteLine();
     }
 }