Skip to content

Instantly share code, notes, and snippets.

View MikeBild's full-sized avatar
🏠
Working from home

Mike Bild MikeBild

🏠
Working from home
View GitHub Profile
public class DisplayNameByResourceKeyAttribute : DisplayNameAttribute
{
public DisplayNameByResourceKeyAttribute(string resourceKey)
{
DisplayNameValue = DisplayNameByResourceKey(resourceKey) ?? resourceKey;
}
private static string DisplayNameByResourceKey(string value)
{
return null;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program2
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
@MikeBild
MikeBild / CodeKataPickAkin.cs
Created May 1, 2011 20:24
Code Kata PickAkin
/*
http://ilker.de/code-kata-pickakin
akinList = [A1,B2,A2,A3,B3,A4,D1,D2,B1]
ceoList = [C1,E1,E2]
controlList = [F1]
*/
var ceoListOriginal = new List<string>() {"A1", "B1", "A2", "A3", "C1", "D1", "E1", "E2"};
@MikeBild
MikeBild / ViewModelField.cs
Created June 17, 2011 15:31
ViewModelField<T>
public class ViewModelField<T> : INotifyPropertyChanged
{
private T _value;
public T Value
{
get { return _value; }
set
{
_value = value;
PropertyChanged(this, new PropertyChangedEventArgs("Value"));
@MikeBild
MikeBild / rakefile.rb
Created June 18, 2011 18:20
MSpec to JUnit Test Report Rake
require 'rake'
require './transform_mspec_report'
desc "Done..."
task :default => [:mspec, :transform] do
puts "Done..."
end
desc "Generate MSpec test report."
task :mspec do
@MikeBild
MikeBild / transform_mspec_report.rb
Created June 18, 2011 18:21
Transform MSpec to JUnit
require "nokogiri"
class TransformMSpecReport
def self.transform()
doc = Nokogiri::XML(File.read('test_result.xml'))
xslt = Nokogiri::XSLT(File.read('mSpec2JUnit.xslt'))
doc = xslt.transform(doc)
File.open('test_result_junit.xml', 'w') {|f| f.write(doc) }
puts "File transformed."
end
@MikeBild
MikeBild / mSpec2JUnit.xslt
Created June 18, 2011 18:22
MSpec to JUnit XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="specs" select="//specification"/>
<xsl:template match="MSpec">
<testsuite
name="Specifications"
tests="{count($specs)}"
errors="0"
@MikeBild
MikeBild / ZeroMqDocumentSaga.cs
Created February 15, 2012 23:04
Minimod.MessageProcessor and Minimod.ZeroMqMessageStream as Document Saga (Message) Demo
using System;
using System.Reactive.Linq;
using Minimod.MessageProcessor;
using Minimod.ZeroMqMessageStream;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
@MikeBild
MikeBild / rx-test
Created September 13, 2012 17:30
Rx-Testing
var sut = Observable.Start(() =>
{
return "Demo";
});
var testScheduler = new Microsoft.Reactive.Testing.TestScheduler();
var actual = testScheduler.Start(() => sut);
Microsoft.Reactive.Testing.ReactiveAssert.AreElementsEqual(actual.Messages, new[] {
new Recorded<Notification<string>>(200, Notification.CreateOnNext("Demo")),