public void WhenThereIsNoOutputConfigured_ThrowApplicationException() { //Arrange var helloWorld = new HelloWorldBuilder().Build(); //Act Action print = () => helloWorld.Print(); //Assert print.Should().Throw <ApplicationException>(); }
static void Main(string[] args) { var hello = new HelloWorldBuilder() .UseLanguage(Language.English) .UseMessage("Hello there!") .PrintToConsole(configuration => configuration .WithForegroundColor(ConsoleColor.Cyan) .WithBackgroundColor(ConsoleColor.DarkGreen)) .Build(); hello.Print(); }
public void WhenPrintIsCalled_RaiseOnPrintEvent() { //Arrange var message = "Hello, World!"; var helloWorld = new HelloWorldBuilder() .UseMessage(message) .PrintToConsole() .Build(); string messageFromEvent = null; helloWorld.OnPrint += (sender, args) => messageFromEvent = args.Message; //Act helloWorld.Print(); //Assert messageFromEvent.Should().BeEquivalentTo(message); }
private static void RunHelloWorld() { const string FileName = "HelloWorld"; const string SrcFile = FileName + ".cs"; const string ExeFile = FileName + ".exe"; // Create code graph CodeCompileUnit codeGraph = HelloWorldBuilder.Build(); // Generate file based on code graph FileGenerator.CreateFile(codeGraph, SrcFile); // Compile generated source file into an executable output file CodeCompiler.Compile(SrcFile, ExeFile); // Execute compiled app Process.Start(ExeFile); }
public DIController(HelloWorldBuilder builder) { Builder = builder; }
public DIController(HelloWorldBuilder builder) { Builder = builder; }