Skip to content

Instantly share code, notes, and snippets.

View agross's full-sized avatar
🔪
Sharpening the saw

Alexander Groß agross

🔪
Sharpening the saw
View GitHub Profile
public class When_a_message_header_is_parsed : With_message_and_parser
{
Establish_multiple contexts = () => new Action[]
{
() =>
{
Message = Load("Messages\\One level, empty quote prefix.txt");
Parser = new MessageParser(" ");
},
() =>
public class When_a_message_header_with_a_prefix_is_parsed : With_message_and_parser
{
Establish context = () =>
{
Message = Load("Messages\\One level.txt");
Parser = new MessageParser("| ");
};
}
public class When_a_message_header_with_no_prefix_is_parsed : With_message_and_parser
public class When_a_message_header_with_an_empty_prefix_is_parsed : With_message_and_parser
{
static When_a_message_header_with_an_empty_prefix_is_parsed()
{
FileName = "Messages\\One level, empty quote prefix.txt";
}
}
public abstract class With_message_and_parser
{
using System;
namespace Machine.Specifications.Specs
{
public class when_a_date_is_parsed_with_the_regular_expression_parser : with_string_parser
{
Establish context = () => { Parser = new RegexParser(); };
It_should_behave_like a_date_time_parser = () => new DateTimeParsingBehavior();
}
public abstract class with_string_parser
{
protected static DateTime ParsedDate;
protected static IParser Parser;
protected Because of = () => { ParsedDate = Parser.Parse("2009/01/21"); };
}
public class when_a_date_is_parsed_by_the_infrastructure : with_string_parser
{
public virtual void SetShippedQuantityFor(Operation operation, int shippedQuantity)
{
Ensure.Argument("operation").IsNotNull(operation);
// Update the passed and all remaining operations with the new quantity.
OperationSequence.SkipWhile(o => o != operation).Each(o => o.SetShippedQuantity(shippedQuantity));
}
using System;
using System.Linq.Expressions;
namespace Indigo.Tools
{
public static class Ensure
{
public static ThrowingValidator Argument(string argument)
{
return new ThrowingValidator(argument);
using System;
using Indigo.ForTesting;
using Machine.Specifications;
namespace Indigo.Tools.Tests
{
[Behaviors]
public class ArgumentNullExceptionBehavior
using Indigo.Runtime.Persistence;
using Machine.Specifications;
using NHibernate;
using NHibernate.Cfg;
using Rhino.Mocks;
namespace Indigo.Runtime.Tests.Persistence
using System;
using System.Diagnostics;
using System.Threading;
using Indigo.ForTesting;
using Machine.Specifications;
namespace Indigo.Tools.Tests
{