public void ClientCodeGenerationDispatcher_Custom_Errors_Full() { ConsoleLogger logger = new ConsoleLogger(); ClientCodeGenerationOptions options = new ClientCodeGenerationOptions() { Language = "C#" }; ICodeGenerationHost host = TestHelper.CreateMockCodeGenerationHost(logger, /*sharedTypeService*/ null); // Create a new dispatcher and call an internal extensibility point to add ourselves // into the MEF composition container using (ClientCodeGenerationDispatcher dispatcher = new ClientCodeGenerationDispatcher()) { string[] compositionAssemblies = new string[] { Assembly.GetExecutingAssembly().Location }; IClientCodeGenerator generator = dispatcher.FindCodeGenerator(host, options, compositionAssemblies, MockCodeGenerator.GeneratorName); Assert.IsNotNull(generator, "the dispatcher did not find any code generator"); Assert.AreEqual(generator.GetType(), typeof(MockCodeGenerator), "dispatcher found " + generator.GetType() + " but should have found MockCodeGenerator"); // The following option makes the custom generator invoke LogError with full file info that // matches the packet below. MockCodeGenerator.LogErrorsFull = true; string generatedCode = generator.GenerateCode(host, Enumerable.Empty <EntityDescription>(), options); Assert.AreEqual(MockCodeGenerator.FakeGeneratedCode, generatedCode, "test code generator did not generate expected code."); TestHelper.AssertContainsErrorPackets(logger, MockCodeGenerator.ErrorPacket); } }