daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Aug 21st, 2018 60 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. public class CodeGenTests
  2.     {
  3.         [NUnit.Framework.Test]
  4.         public void ShouldDebugSources()
  5.         {
  6.             var code =
  7. @"namespace Debuggable
  8. {
  9.     public class HelloWorld
  10.     {
  11.         public string Greet(string name)
  12.         {
  13.             var result = ""Hello, "" + name;
  14.             return result;
  15.         }
  16.     }
  17. }
  18. ";
  19.             var codeGenerator = new CodeGenerator();
  20.             var assembly = codeGenerator.CreateAssembly(code);
  21.  
  22.             dynamic instance = assembly.CreateInstance("Debuggable.HelloWorld");
  23.  
  24.             // Set breakpoint here
  25.             string result = instance.Greet("Roslyn");
  26.  
  27.             result.Should().Be("Hello, Roslyn");
  28.         }
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top