- Unit tests: Review unit tests first. Unit tests are a fantastic way to grasp how code is meant to be used by others and to learn what the expected behavior is. Are there any test gaps that should be there?
- Method arguments" Make sure arguments to methods make sense and are validated. Mentally test boundary conditions and edge cases.
- Null References" (Yah yah, we know. Use F# and this goes away. We get it already.) Null references are a bitch and it’s worth looking out for them specifically.
- Conventions Consistency" Make sure naming, formatting, etc. follow our conventions and are consistent. I like a codebase that’s fairly consistent so you know what to expect.
- Disposables: Make sure disposable things are disposed. Look for usages of resources that should be disposed but are not.
- Security: There is a whole threat and mitigation review process that falls under this bucket. In simple terms, ask yourself how this code could be exploited. The [STRIDE Threat Mo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
using System.Reflection; | |
namespace RegexLibraryBuilder | |
{ | |
/// <summary> | |
/// Summary description for Class1. | |
/// </summary> | |
class RegexBuilderMain | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$dir = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent) | |
Push-Location $dir | |
. (Resolve-Path "$dir\vs2010.ps1") | |
# . "Bradwils\profile.ps1" | |
$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin" | |
# Set up GitHub environment | |
Write-Host "Setting up GitHub Environment" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EnumerableExtensions | |
{ | |
public static Dictionary<TKey, TSource> ToDictionaryBetter<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) | |
{ | |
return source.GroupBy(keySelector).ToDictionary(group => group.Key, group => | |
{ | |
try | |
{ | |
return group.Single(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async static Task<T> ThrowsAsync<T>(Func<Task> testCode) where T : Exception | |
{ | |
try | |
{ | |
await testCode(); | |
Assert.Throws<T>(() => { }); // Use xUnit's default behavior. | |
} | |
catch (T exception) | |
{ | |
return exception; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assert.Throws<SomeException>(async () => await obj.GetAsync()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class Dependency : IDisposable | |
{ | |
public string SomeProperty { get; set; } | |
public void Dispose() | |
{ | |
} | |
} | |
public sealed class Owner : IDisposable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEnumerable<Type> GetLoadableTypes(this Assembly assembly) | |
{ | |
if (assembly == null) throw new ArgumentNullException("assembly"); | |
try | |
{ | |
return assembly.GetTypes(); | |
} | |
catch (ReflectionTypeLoadException e) | |
{ | |
return e.Types.Where(t => t != null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TheContinueAfterMethod | |
{ | |
[Fact] | |
public void RunsNextItemAfterCompletion() | |
{ | |
var stringSequence = new[] { "one", "two", "three" }.ToObservable(); | |
var observed = new List<String>(); | |
Observable.Return(123).ContinueAfter(() => stringSequence) | |
.Subscribe(observed.Add); |