public IViewSource GetViewSource(string templateName, IList <IViewSource> parentViewSourceList) { Invariant.ArgumentNotEmpty(templateName, "templateName"); Invariant.ArgumentNotNull(parentViewSourceList, "parentViewSourceList"); templateName = SuffixWithHaml(templateName); var fileInfo = CreateFileInfo(templateName); if (fileInfo != null && fileInfo.Exists) { return(new FileViewSource(fileInfo)); } for (var index = 0; index < parentViewSourceList.Count; index++) { var source = parentViewSourceList[index]; //search where the current parent template exists var parentDirectory = Path.GetDirectoryName(source.Path); var combine = Path.Combine(parentDirectory, templateName); if (File.Exists(combine)) { return(new FileViewSource(new FileInfo(combine))); } } throw new FileNotFoundException(string.Format("Could not find template '{0}'.", templateName)); }
public void AddReference(string assemblyLocation) { Invariant.ArgumentNotEmpty(assemblyLocation, "assemblyLocation"); //TODO: sort this with iron ruby if (assemblyLocation.ToLower().EndsWith("mscorlib.dll")) { return; } References.Add(assemblyLocation); }
public IDictionary <string, object> BuildAndValidateParameters() { var parameters = BuildParameters(); if (!SkipOptionalParameterCheck) { foreach (var item in parameters) { if (!OptionalParameters.Contains(item.Key)) { Invariant.ArgumentNotEmpty(item.Value.AsString(), () => "Parameter '{0}' for named query '{1}' may not be null or empty".FormatInvariantCulture(item.Key, Name)); } } } return(parameters); }
public ViewSource GetViewSource(string templateName, IEnumerable <ViewSource> parentViewSourceList) { Invariant.ArgumentNotEmpty(templateName, "templateName"); Invariant.ArgumentNotNull(parentViewSourceList, "parentViewSourceList"); templateName = SuffixWithHaml(templateName); var fileInfo = CreateFileInfo(templateName); if (fileInfo != null && fileInfo.Exists) { return(new FileViewSource(fileInfo)); } //foreach (var source in parentViewSourceList) //{ // //search where the current parent template exists // var parentDirectory = Path.GetDirectoryName(source.FilePath); // var combine = Path.Combine(parentDirectory, templateName); // if (File.Exists(combine)) // return new FileViewSource(new FileInfo(combine)); //} throw new FileNotFoundException(string.Format("Could not find template '{0}'.", templateName)); }
public void ArgumentNotEmpty_EmptyString_ThrowsArgumentOutOfRangeException() { Assert.Throws <ArgumentOutOfRangeException>(() => Invariant.ArgumentNotEmpty(string.Empty, "param")); }
public void ArgumentNotEmpty_NullArgument_ThrowsArgumentNullException() { Assert.Throws <ArgumentNullException>(() => Invariant.ArgumentNotEmpty(null, "param")); }
public void ArgumentNotEmpty_ValidString_DoesNothing() { Assert.DoesNotThrow(() => Invariant.ArgumentNotEmpty("Test", "param")); }
public void AddUsing(string @namespace) { Invariant.ArgumentNotEmpty(@namespace, "namespace"); Usings.Add(@namespace); }
public bool IsAutoClosingTag(string tag) { Invariant.ArgumentNotEmpty(tag, "tag"); return(AutoClosingTags.Contains(tag.ToUpperInvariant())); }