Skip to content

Instantly share code, notes, and snippets.

View follesoe's full-sized avatar
📱
Working on Skredvarsel app

Jonas Follesø follesoe

📱
Working on Skredvarsel app
View GitHub Profile
public abstract class BDD<T> where T : BDD<T>
{
protected T Given { get { return (T)this; } }
protected T When { get { return (T)this; } }
protected T Then { get { return (T)this; } }
protected T And { get { return (T)this; } }
}
[TestMethod]
public void Fires_event_when_recording_is_complete()
{
string filename = null;
viewModel.RecordingComplete += (o, e) => filename = e.Filename;
viewModel.RecordingCommand.Execute(null); // Start recording
viewModel.RecordingCommand.Execute(null); // Stop recording
Assert.IsNotNull(filename, "Should fire event when recording is complete.");
<UserControl x:Class="UsercontrolContentControl.Overlay"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<ContentControl Content="{Binding OverlayContent}" />
</Grid>
</UserControl>
namespace BlackBox.CodeGeneration
{
public class TestFlavour
{
public string Namespace { get; private set;}
public string TestAttribute { get; private set; }
public string ClassAttribute { get; private set; }
public string SetupAttribute { get; private set; }
public bool ConstructorAsSetup()
public class AirlineNamesService
{
private readonly Uri _serviceUrl;
public AirlineNamesService()
{
_serviceUrl = new Uri("http://flydata.avinor.no/airlineNames.asp");
}
public IObservable<Airline> GetAirlines()
// Tiniest BDD DSL/framework around?
// Licensed under MSPL/FreeBSD/ISC or any other OSS license you want
// Original idea from http://blog.kjempekjekt.com/2009/08/13/ultra-tiny-given-when-then-dsl-snippet/,
// turned into generic base class by Jonas Follesø.
public abstract class BDD<T> where T : BDD<T>
{
protected T Given { get { return (T)this; } }
protected T And { get { return (T)this; } }
protected T When { get { return (T)this; } }
[TestClass]
public class XmlFormatDetectorTest : BDDTest<XmlFormatDetectorTest>
{
[TestMethod]
public void Detects_that_a_file_follows_the_FHNBransjestandard1_format()
{
Given.we_got_a_file("FNHBransjestandard1.xml");
When.we_try_to_detect_the_file_format();
Then.fileformat.ShouldBe(KnownFileFormats.FNHBransjestandard1);
}
using System.Collections;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace KS.Bestandsrapportering.TestInfrastruktur
{
public static class TestExtensions
{
public static void SkalVæreLik(this object valueToTest, object expected)
{
[TestClass]
public class SomeTest
{
[TestMethod]
public void Test_threaded_code()
{
var db = new SomeDbMock();
var bl = new SomeCode(db);
bl.DoSomething();
public static void UseSomeDynamicCode()
{
IDoSomething wrapper = DynamicWrapper.Wrap<IDoSomething>("some_script.rb");
int sum = wrapper.Add(5, 5);
}
public interface IDoSomething
{
int Add(int a, int b);
}