Skip to content

Commit

Permalink
cleanup if without {} in the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
travislaborde committed Mar 17, 2017
1 parent 20bde08 commit 053c82d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
4 changes: 2 additions & 2 deletions XmlSchemaClassGenerator.Tests/AssertEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static async Task ThrowsAsync<TException>(Func<Task> func)

public static void Equal(object o1, object o2)
{
if (o1 == null && o2 == null) return;
if (o1 == null && o2 == null) { return; }
Assert.NotNull(o1);
Assert.NotNull(o2);

Expand Down Expand Up @@ -83,7 +83,7 @@ public static void Equal(object o1, object o2)

public static void CollectionEqual<T>(IList<T> l1, IList<T> l2)
{
if (l1 == null && l2 == null) return;
if (l1 == null && l2 == null) { return; }
Assert.NotNull(l1);
Assert.NotNull(l2);

Expand Down
32 changes: 16 additions & 16 deletions XmlSchemaClassGenerator.Tests/Glob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Cancel()

private void Log(string s, params object[] args)
{
if (ErrorLog != null) ErrorLog(string.Format(s, args));
if (ErrorLog != null) { ErrorLog(string.Format(s, args)); }
}

/// <summary>
Expand Down Expand Up @@ -170,7 +170,7 @@ public bool IsMatch(string input)

private RegexOrString CreateRegexOrString(string pattern)
{
if (!CacheRegexes) return new RegexOrString(GlobToRegex(pattern), pattern, IgnoreCase, compileRegex: false);
if (!CacheRegexes) { return new RegexOrString(GlobToRegex(pattern), pattern, IgnoreCase, compileRegex: false); }

RegexOrString regexOrString;

Expand All @@ -187,7 +187,7 @@ private RegexOrString CreateRegexOrString(string pattern)

private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
{
if (Cancelled) yield break;
if (Cancelled) { yield break; }

if (string.IsNullOrEmpty(path))
{
Expand All @@ -209,10 +209,10 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error getting FileSystemInfo for '{0}': {1}", path, ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
}

if (exists) yield return fsi;
if (exists) { yield return fsi; }
yield break;
}

Expand All @@ -225,7 +225,7 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error getting directory name for '{0}': {1}", path, ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
yield break;
}

Expand All @@ -240,10 +240,10 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error getting DirectoryInfo for '{0}': {1}", path, ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
}

if (dir != null) yield return dir;
if (dir != null) { yield return dir; }
yield break;
}

Expand All @@ -256,7 +256,7 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error getting current working directory: {1}", ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
}
}

Expand Down Expand Up @@ -290,7 +290,7 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error finding recursive directory in {0}: {1}.", dir, ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
continue;
}

Expand Down Expand Up @@ -318,7 +318,7 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
catch (Exception ex)
{
Log("Error finding file system entries in {0}: {1}.", parentDir, ex);
if (ThrowOnError) throw;
if (ThrowOnError) { throw; }
continue;
}

Expand All @@ -330,8 +330,8 @@ private IEnumerable<FileSystemInfo> Expand(string path, bool dirOnly)
}
}

if (childRegexes.Any(r => r.Pattern == @"^\.\.$")) yield return parentDir.Parent ?? parentDir;
if (childRegexes.Any(r => r.Pattern == @"^\.$")) yield return parentDir;
if (childRegexes.Any(r => r.Pattern == @"^\.\.$")) { yield return parentDir.Parent ?? parentDir; }
if (childRegexes.Any(r => r.Pattern == @"^\.$")) { yield return parentDir; }
}
}

Expand All @@ -348,7 +348,7 @@ private static string GlobToRegex(string glob)
{
if (characterClass)
{
if (c == ']') characterClass = false;
if (c == ']') { characterClass = false; }
regex.Append(c);
continue;
}
Expand All @@ -366,7 +366,7 @@ private static string GlobToRegex(string glob)
regex.Append(c);
break;
default:
if (RegexSpecialChars.Contains(c)) regex.Append('\\');
if (RegexSpecialChars.Contains(c)) { regex.Append('\\'); }
regex.Append(c);
break;
}
Expand Down Expand Up @@ -511,7 +511,7 @@ public override int GetHashCode()
public override bool Equals(object obj)
{
//Check for null and compare run-time types.
if (obj == null || GetType() != obj.GetType()) return false;
if (obj == null || GetType() != obj.GetType()) { return false; }

Glob g = (Glob)obj;
return Pattern == g.Pattern;
Expand Down
4 changes: 3 additions & 1 deletion XmlSchemaClassGenerator.Tests/XmlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class XmlTests

private Assembly Compile(string name, string pattern, Generator generatorPrototype = null)
{
if (Assemblies.ContainsKey(name)) return Assemblies[name];
if (Assemblies.ContainsKey(name)) { return Assemblies[name]; }

var cs = new List<string>();

Expand Down Expand Up @@ -167,7 +167,9 @@ private void DeserializeSampleXml(string pattern, Assembly assembly)
{
// generator doesn't generate valid values where pattern restrictions exist, e.g. email
if (!e.Message.Contains("The Pattern constraint failed"))
{
Assert.True(false, e.Message);
}
};

XmlReader reader = XmlReader.Create(new StringReader(xml2), settings);
Expand Down

0 comments on commit 053c82d

Please sign in to comment.