static ApiGenerator() { RazorHelper = new RazorMachine(); Assembly = typeof(ApiGenerator).Assembly; var directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory()); if (directoryInfo.Name == "CodeGeneration.LowLevelClient" && directoryInfo.Parent != null && directoryInfo.Parent.Name == "CodeGeneration") { // running as a dnx project NestFolder = @"..\..\..\src\Nest\"; EsNetFolder = @"..\..\..\src\Elasticsearch.Net\"; ViewFolder = @"Views\"; ApiEndpointsFolder = @"ApiEndpoints\"; } else { NestFolder = @"..\..\..\..\..\..\src\Nest\"; EsNetFolder = @"..\..\..\..\..\..\src\Elasticsearch.Net\"; ViewFolder = @"..\..\..\Views\"; ApiEndpointsFolder = @"..\..\..\ApiEndpoints\"; } }
static ViewResult() { // Set defaults // ViewBase = "Views"; using (var stream = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("WebSharp.MVC.DefaultRazorConfig.xml"))) Razor = new RazorMachine(stream.ReadToEnd()); }
public void RazorMachineResultShouldContainTestText() { var rm = new RazorMachine(); rm.RegisterTemplate("~/shared/_layout.cshtml", _layoutRazor); var renderedContent = rm.ExecuteContent(string.Format("{0}{1}", "@{Layout=\"_layout\";}", _templateRazor), _modelJson); var result = renderedContent.Result; Console.Write(result); Assert.IsTrue(result.Contains(MatchText)); }
static YamlTestsGenerator() { _razorMachine = new RazorMachine(); _assembly = typeof (YamlTestsGenerator).Assembly; RegisterView("Do"); RegisterView("Set"); RegisterView("IsTrue"); RegisterView("IsFalse"); RegisterView("LowerThan"); RegisterView("GreaterThan"); RegisterView("Length"); RegisterView("Match"); RegisterView("Skip"); RegisterView("DispatchSteps"); RegisterView("SetupClass"); var rawCalls = from l in File.ReadAllLines(_rawClientInterface) where Regex.IsMatch(l, @"\tElasticsearchResponse<[^>]+> ") select Regex.Replace(l,@"\t\tElasticsearchResponse<[^>]+>", "").Trim(); RawElasticCalls = rawCalls.ToList(); }
static ApiGenerator() { _razorMachine = new RazorMachine(); _assembly = typeof(ApiGenerator).Assembly; }
static ApiGenerator() { RazorHelper = new RazorMachine(); Assembly = typeof(ApiGenerator).Assembly; }
public RazorMachineWrapper() { _razorMachine = new RazorMachine(); }