/// <summary> /// Returns the Razor view with mocked viewmodel. /// </summary> /// <param name="path"></param> /// <param name="code"></param> /// <returns></returns> public ActionResult PatternWithModel(string path, string code) { object model = null; var patternPath = Path.Combine(Constants.RazorPatternViewsPath, path); var modelTypeName = RazorParser.GetModelTypeName(code); if (!string.IsNullOrEmpty(modelTypeName)) { var modelType = TypeFinder.GetTypeByName(modelTypeName); if (modelType != null) { // get the full file path of the mock data JSON file var patternDataPath = Server.MapPath(patternPath.Replace(".cshtml", ".json")); model = MockBuilder.Create(modelType, patternDataPath); } } return(PartialView(patternPath, model)); }