Skip to content

Instantly share code, notes, and snippets.

View JayBazuzi's full-sized avatar

Jay Bazuzi JayBazuzi

View GitHub Profile
# 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
// 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);
}
// 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)
{
[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
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);
throw new Exception(string.Format("The foo was out of range ({0})", foo));
class FooOutOfRangeException : Exception
{
public readonly string Foo;
public FooOutOfRangeException(string foo)
{
Foo = foo;
}
public override string Message
// 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 (...)");
static void Main()
{
Test_PrimeFactorsOf14ShouldBe3();
Test_PrimeFactorsOf14ShouldBe1_2_7();
}
static void Test_PrimeFactorsOf14ShouldBe3()
{
var result = CalculatePrimeFactors(3);
if (!result.SequenceEqual(new[] { 3 }))
abstract class AdapterTestsBase
{
public abstract IPort CreateSubject();
[TestMethod]
public void FShouldBlah()
{
IPort subject = CreateSubject();
int result = subject.F();
Assert.AreEqual(7, result);