Skip to content

Instantly share code, notes, and snippets.

View adamralph's full-sized avatar
🤗
Living the dream

Adam Ralph adamralph

🤗
Living the dream
View GitHub Profile
@adamralph
adamralph / passing.txt
Last active August 29, 2015 14:17
Messages from an xbehave 2.0 beta 7 scenario with 3 steps
With all steps passing:
TestAssemblyStarting
TestCollectionStarting
TestClassStarting
TestMethodStarting
TestCaseStarting
TestStarting
TestPassed
TestFinished
@adamralph
adamralph / gist.csx
Created July 30, 2015 19:46
Sample script for testing scriptcs Gist module against https://gist.github.com/ryanrousseau/0dca8b3a74958f82406a
#gist 0dca8b3a74958f82406a
var pinger = new Pinger();
pinger.Ping();
Console.WriteLine("done!");
C:\code\Particular\NServiceBus.RabbitMQ-Issue-102\Sample\bin\Debug [master]> .\Sample.exe
2015-10-05 18:17:18.520 INFO DefaultFactory Logging to 'C:\code\Particular\NServiceBus.RabbitMQ-Issue-102\Sample\bin\Debug\' with level Info
2015-10-05 18:17:18.565 INFO NServiceBus.Persistence.PersistenceStartup Activating persistence 'InMemoryPersistence' to provide storage for 'NServiceBus.Persistence.StorageType+Sagas' storage.
2015-10-05 18:17:18.587 INFO NServiceBus.Persistence.PersistenceStartup Activating persistence 'InMemoryPersistence' to provide storage for 'NServiceBus.Persistence.StorageType+Timeouts' storage.
2015-10-05 18:17:18.607 INFO NServiceBus.Persistence.PersistenceStartup Activating persistence 'InMemoryPersistence' to provide storage for 'NServiceBus.Persistence.StorageType+Subscriptions' storage.
2015-10-05 18:17:18.626 INFO NServiceBus.Persistence.PersistenceStartup Activating persistence 'InMemoryPersistence' to provide storage for 'NServiceBus.Persistence.StorageType+Outbox' storage.
2015
@adamralph
adamralph / gist:3051724
Created July 5, 2012 06:19
RE: 3047138
public class Different
{
private ISomething something;
public Different(ISomethingProvider somethingProvider)
{
this.something = somethingProvider.Provide();
}
}
@adamralph
adamralph / gist:3184291
Created July 26, 2012 20:25
xBehave.net collection contents example
[Scenario]
public static void GettingACollection
{
var provider = default(CollectionProvider);
var collection = default(Collection);
"Given a collection provider"
.Given(() => provider = new CollectionProvider());
"When getting a collection"
@adamralph
adamralph / gist:3886106
Created October 13, 2012 20:49
xBehave.net re-write for bwatts
public class RuntimeFeature
{
[Scenario]
public void ApplyDependentCalculation()
{
int _left1;
int _right1;
int _left2;
Variable _outputVariable1;
Variable _outputVariable2;
@adamralph
adamralph / NoBaseClass.cs
Created October 20, 2012 13:02 — forked from bwatts/NoBaseClass.cs
Behaviors with LINQ syntax using a scenario monad
public class IntervalFeature
{
[Scenario]
public void ComparisonUsingLinq()
{
var result =
from left in "Given an interval".Of(Interval.WholeStep)
from right in "And a smaller interval".Of(Interval.HalfStep)
select "When comparing the intervals".Do(left.CompareTo(right));
@adamralph
adamralph / github-jekyll-email
Created January 9, 2013 06:47
Email to GitHub support regarding Jekyll excerpts problem
Hi,
In my github pages site I have some code which generates excerpts from posts https://github.com/adamralph/adamralph.github.com/blob/master/index.html#L13
This worked on 6th Jan, which was the last time I pushed a change before today.
However, after pushing an unrelated change today, the code has stopped working. Instead of an excerpt, the entire post is shown - see http://www.adamralph.com/
Another user has also reported the same problem with his site and has temporarily removed his excerpts code, the diff is at https://github.com/alfhenrik/henri.kandersson.com/commit/b60804d36e203f14af312e08f4c2e5b566cc9fc8#L0L15
@adamralph
adamralph / gist:4746267
Last active December 12, 2015 08:48
I <3 xBehave.net! for more info see https://github.com/xbehave/xbehave.net
[Scenario]
[Example(typeof(int), 0)]
[Example(typeof(object), null)]
public static void GeneratedDefaultValue<TValue>
(Type type, TValue expectedValue, Argument argument)
{
"Given the type {0}"
.Given(() => { });
"When constructing an argument using the type"
@adamralph
adamralph / xBehave.net with ExpandoObject
Last active December 12, 2015 10:39
I did a spike once for xBehave.net which would allow this in .NET 4.0+. The `scenario` object which is passed as an argument to each step expression is an `ExpandoObject` typed as `dynamic`. I'd love to come up with a solution which doesn't have the issue noted in the code.
[Scenario]
public void PushingAnElementOntoAStack() // No parameters :-D
{
"Given an element"
.Given(scenario => scenario.Element = 11);
"And a stack"
.And(scenario => scenario.Stack = new Stack<int>());
"When pushing the element onto the stack"