Skip to content

Instantly share code, notes, and snippets.

View thecodejunkie's full-sized avatar

Andreas Håkansson thecodejunkie

View GitHub Profile
var p = new Program();
Console.WriteLine(p.Text);
Console.ReadLine();
@thecodejunkie
thecodejunkie / XUnitResharperLiveTemplateIssue.cs
Created November 25, 2010 06:41
$END$ appears to append an extra blank link
[Fact]
public void Should_$expectation$()
{
//Given
// When
// Then
@thecodejunkie
thecodejunkie / gist:744164
Created December 16, 2010 22:54
xmlformatter tests are non-determanistic
Test 'Nancy.Formatters.Tests.XmlFormatterExtensionsFixtures.Should_return_a_valid_model_in_xml_format' failed: Assert.Equal() Failure
Position: First difference is at position 39
Expected: <?xml version="1.0"?>
<Person xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirstName>Andy</FirstName>
<LastName>Pike</LastName>
</Person>
Actual: <?xml version="1.0"?>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FirstName>Andy</FirstName>
@thecodejunkie
thecodejunkie / gist:746465
Created December 18, 2010 12:30
posh-git log
DEBUG: 00000:Finding branch
DEBUG: 00007:Trying symbolic-ref
DEBUG: 04704:Got branch
DEBUG: 04706:Getting status
DEBUG: 07971:Parsing status
DEBUG: 07975:Status: ## predicates
DEBUG: 07976:Building status object
DEBUG: 07982:Finished
@thecodejunkie
thecodejunkie / build.rb
Created January 8, 2011 23:25
Start of Nancy rake file
require 'rubygems'
require 'albacore'
OUTPUT = "build"
CONFIGURATION = 'Release'
ROOT_FOLDER = File.expand_path(File.dirname(__FILE__))
ARTIFACTS_FOLDER = File.expand_path(File.join(File.dirname(__FILE__), "build")) + '/'
SHARED_ASSEMBLY_INFO = 'src/SharedAssemblyInfo.cs'
SOLUTION_FILE = 'src/Nancy.sln'
ARTIFACTS_FOLDER = File.expand_path(File.join(File.dirname(__FILE__), "build")) + '/'
@thecodejunkie
thecodejunkie / gist:787002
Created January 19, 2011 22:17
Using albacore to run multiple xunit test projects with rake
testAssemblies = FileList["src/**/Release/*.Tests.dll"].exclude(/obj\//)
testAssemblies.each do |testAssembly|
xunit :xunit do |xunit|
xunit.command = "tools/xunit/xunit.console.clr4.x86.exe"
xunit.assembly = testAssembly
end
end
@thecodejunkie
thecodejunkie / gist:787550
Created January 20, 2011 07:52
mspec and xunit testing for Nancy using Albacore and Rake
desc "Executes MSpec tests"
mspec :mspec do |mspec|
mspec.command = "tools/mSpec/mspec.exe"
mspec.assemblies "src/Nancy.Tests/bin/#{CONFIGURATION}/Nancy.Tests.dll"
end
testAssemblies = FileList["src/**/#{CONFIGURATION}/*.Tests.dll"].exclude(/obj\//)
testAssemblies.each do |testAssembly|
desc "Executes xUnit tests"
xunit :xunit do |xunit|
@thecodejunkie
thecodejunkie / gist:795650
Created January 25, 2011 21:00
implicit cast operators on the dynamicdictionaryvalue
namespace ConsoleApplication1
{
using System.Dynamic;
class Program
{
static void Main(string[] args)
{
dynamic dictionary = new DynamicDictionary();
dictionary.foo = "test";
[Fact]
public void Should_be_able_to_impliclity_cast_dynamic_member_to_int()
{
// Given
this.dictionary.foo = 2;
// When
int value = this.GetIntValue(this.dictionary.foo);
// Then