This file contains 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.Collections.Generic; | |
using System.Linq; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var container = new Container(); | |
container.Bind<ICar, Car>(); |
This file contains 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 Nancy; | |
using Nancy.ModelBinding; | |
public class TurtleModule : NancyModule | |
{ | |
public TurtleModule() : base("/turtle") | |
{ | |
// Note: arguments can be named anything. | |
Get["/"] = arguments => | |
{ |
This file contains 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
ko.bindingHandlers.date = { | |
update: function(element, valueAccessor, allBindingsAccessor) { | |
var value = ko.utils.unwrapObservable(valueAccessor()); | |
var allBindings = allBindingsAccessor(); | |
var format = allBindings.format || 'DD/MM/YYYY'; // default format. | |
if (value && value != 'Invalid Date') { | |
var formattedDate = moment(value).format(format); | |
if ($(element).is('input')) { |
This file contains 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
class RandomObject | |
{ | |
public decimal? PropertyA { get; set; } | |
public decimal? PropertyB { get; set; } | |
} | |
class CalculatePropertyA : ICalculator | |
{ | |
string Name { get { return "PropertyA"; } } | |
This file contains 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 Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var store = Wireup.Init().UsingInMemoryPersistence().Build(); | |
var repository = new EventStoreRepository(store, new AggregateFactory(), new ConflictDetector()); | |
var handler = new CreatePostCommandHandler(repository); | |
handler.Execute(new CreatePostCommand(new Guid(), "Test Title", "Test Description")); | |
} |
This file contains 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
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)] | |
public class ಠ_ಠAttribute : Attribute | |
{ | |
public ILog Log { get; set; } | |
public ಠ_ಠAttribute() | |
{ | |
Log.Info("This code is bad and you should feel bad"); | |
} | |
} |
This file contains 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
namespace Kata | |
{ | |
using System.Collections.Generic; | |
using System.Linq; | |
using Xunit; | |
public interface ICheckout | |
{ | |
void Scan(string item); |
This file contains 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 FooReserver | |
{ | |
private readonly int reserveFor; | |
public static List<string> ReservedFoos = new List<string>(); | |
public FooReserver(int reserveFor) | |
{ | |
this.reserveFor = reserveFor; | |
} |
This file contains 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 GameId : TypedGuid | |
{ | |
} | |
public class TypedGuid | |
{ | |
protected Guid Value { get; set; } | |
public static implicit operator Guid(TypedGuid typedGuid) | |
{ |
This file contains 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
var decision = "Dave".DecidesTo<InviteToLobby>(); | |
decision.ProvidedDataIs("something"); | |
decision.NewKnowledgeIs<InvitedToLobby>((e) => e.Something.ShouldBe("test")); | |
decision.IsAvailableWhen(() => new TestTopicInValidState()); | |
decision.IsntAvailableWhen<ExpectedException>(() => new TestTopicInInvalidState()); |
OlderNewer