Skip to content

Instantly share code, notes, and snippets.

View JayBazuzi's full-sized avatar

Jay Bazuzi JayBazuzi

View GitHub Profile
// before
testSubject.Invoking(ts => ts.F())
.ShouldThrow<Exception>()
.WithMessage("the foo was out of range (...)");
// after
testSubject.Invoking(ts => ts.F())
.ShouldThrow<FooOutOfRangeException>()
.And.Foo.Should().Be("...");
new FooOutOfRangeException("...").Message.Should().Be("the foo was out of range (...)");
class FooOutOfRangeException : Exception
{
public readonly string Foo;
public FooOutOfRangeException(string foo)
{
Foo = foo;
}
public override string Message
throw new Exception(string.Format("The foo was out of range ({0})", foo));
int X = 0;
Task.Run(() =>
{
Thread.Sleep(TimeSpan.FromSeconds(1));
X++;
});
{// Extract Method on this block
Thread.Sleep(TimeSpan.FromSeconds(2));
Assert.AreEqual(1, X);
[13:17:11.5175-LocalBuildTask-33] ERROR (Internal): System.NullReferenceException: Object reference not set to an instance of an object.
at nCrunch.Common.IO.DirectoryPath.GetNumberOfCommonDirectories(DirectoryPath path1, DirectoryPath path2)
at nCrunch.Common.IO.DiskPath.DoRebase(DirectoryPath originalBase, DirectoryPath newBase)
at nCrunch.Common.IO.FilePath.Rebase(DirectoryPath originalBase, DirectoryPath newBase)
at nCrunch.Core.BuildManagement.BuildEnvironment.(DirectoryPath , IList`1 )
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, CustomEnvironmentVariable[] customEnvironmentVariables)
at nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
at nCrunch.Core.Processing.TaskLogic.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.LocalProcessingTask.ProcessTaskAndReturnSuccessFlag()
at nCrunch.Client.Processing.ProcessingQueue.(LocalP
// If provided, get and log the response from the remote host.
IfProvidedGetAndLogResponseFromRemoteHost(logger, ex.Response);
// ---------------------------------------
void IfProvidedGetAndLogResponseFromRemoteHost(logger, webResponse)
{
var response = string.Empty;
if (response != null)
{
// If provided, get and log the response from the remote host.
var response = string.Empty;
if (ex.Response != null)
{
using (var readerStream = new StreamReader(ex.Response.GetResponseStream()))
{
response = readerStream.ReadToEnd().Trim();
logger.Error("Error response:");
logger.Error(response);
}
# dev
http://boxstarter.org/package/sysinternals,resharper,ncrunch,git,poshgit
# desktop
http://boxstarter.org/package/lastpass,googlechrome,skype,steam,putty,dotnet35
# kids
http://boxstarter.org/package/minecraft,vlc
class Program
{
private static void Main(string[] args)
{
switch (args[0])
{
case "foo":
{
IOperation operation = new FooOperation();
operation.Do();
class Program
{
private static void Main(string[] args)
{
IOperation operation;
switch (args[0])
{
case "foo":
{
operation = new FooOperation();