Skip to content

Instantly share code, notes, and snippets.

[Given(@"i'm on the homepage")]
[Given(@"on the homepage")]
[Given(@"I have navigated to the homepage")]
[When(@"i'm on the homepage")]
public void HomePage()
{}
@marcusoftnet
marcusoftnet / gist:2774047
Created May 23, 2012 09:04
AutomationID via FluentAutomation
I.Enter("Some text").In("input[data-automationid='userNameField']");
@marcusoftnet
marcusoftnet / gist:3349404
Created August 14, 2012 13:49
WithClause constraing to Top 1
// Given this simple class
public class Kid
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Quote> Quotes { get; set; }
}
// Now I have to write this long-winding code
private Kid GetKidWithQoutes(int kidId)
@marcusoftnet
marcusoftnet / app.config
Created August 29, 2012 12:21 — forked from aliostad/app.config
Turn off simple.data tracing
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="simpleData">
<section
name="simpleDataConfiguration"
type="Simple.Data.SimpleDataConfigurationSection, Simple.Data"/>
</sectionGroup>
</configSections>
<simpleData>
@marcusoftnet
marcusoftnet / gist:4563590
Created January 18, 2013 10:10
Creating NancyTesting.Browser with a bootstrapper. A couple of examples
// Creating a testing browser with a default nancy bootstrapper
// This sets the browser up in the default state using
// all the default conventions, engines and locations etc.
var browser = new Browser(new DefaultNancyBootstrapper(););
// If you want to control the execution a bit more, use
// the Nancy.Testing.ConfigurableBootstrapper.
// Simplest way to do that is to supply a lambda expression
// In this case I will configure the browser to just load
[Fact]
public void showing_the_complete_stack_testing_in_NancyTesting()
{
// Set up a browser to test MySimpleModule only
var browser = new Browser(with => with.Module(new MySimpleModule()));
// Perform a request, in this case a HTTP-GET to "/login"
// with a query-string
// But this can of course be any HTTP verb and you can send in
// forms, raw body-stream etc. Later blog-posts on that.
@marcusoftnet
marcusoftnet / FirstTest.cs
Created January 18, 2013 10:37
SimpleGetNancyTest
[Fact]
public void simplest_get_test()
{
// Arrange
var browser = new Browser(with => with.Module(new SimpleModule()));
// Act
var response = browser.Get("/");
// Assert
@marcusoftnet
marcusoftnet / SimpleModule.cs
Created January 18, 2013 10:45
Simplest module
public class SimpleModule : NancyModule
{
public SimpleModule()
{
Get["/"] = p => { return HttpStatusCode.OK; };
}
}
var browser =
new Browser(
with =>
with.Module<ConfigBootTestModule>()
);
public class ConfigBootTestModule : NancyModule
{
public ConfigBootTestModule() : base("/config")
{
Get["/"] = p => { return "Hello configured fellow"; };
}
}
[Fact]