Skip to content

Instantly share code, notes, and snippets.

View JakeGinnivan's full-sized avatar
:shipit:

Jake Ginnivan JakeGinnivan

:shipit:
View GitHub Profile
using NUnit.Framework;
using TestStack.BDDfy.Core;
using TestStack.BDDfy.Scanners.StepScanners.Fluent;
namespace TestStack.BDDfy.Samples.Atm
{
[Story(
AsA = "As an Account Holder",
IWant = "I want to withdraw cash from an ATM",
SoThat = "So that I can get money when the bank is closed")]
public class FooController : Controller{
IService service;
public FooController(IService service){
this.service = service;
}
public ActionResult Bar(){
service.DoStuff();
}
var cb = new ContainerBuilder();
cb.RegisterType<Foo>().As<IFoo>().InstancePerLifetimeScope();
cb.RegisterType<Bar>().As<IBar>().InstancePerMatchingLifetimeScope("LifetimeScopeTag");
var container = cb.Build();
using (var scope = container.BeginLifetimeScope("LifetimeScopeTag"))
{
IFoo foo1;
IFoo foo2;
IBar bar1;
void Main()
{
var app = Application.LaunchWindows8Application("Microsoft.BingWeather_8wekyb3d8bbwe!App");
var window = app.GetWindows().Single();
OpenAppBar();
window.Get<Hyperlink>("Home_link").Click();
OpenAppBar();
window.Get<Hyperlink>("MyPlaces_link").Click();
var tile = window.Get<GroupBox>("CommonJS_UI_ResponsiveListView_Cluster1_Content_ListView2AddTile");
tile.Click();
private static void BrokenDynamic()
{
IFoo foo = new Foo();
var method = typeof(IFoo).GetMethod("Bar");
string d = "test";
method.Invoke(foo, new[]{d});
}
public class DomainClass
{
public DomainClass(AnotherDomainClass dep, string arg){
//logic
}
}
public class AnotherDomainClass{
public AnotherDomainClass(string arg, string arg2){
//ctor logic
public class Foo : IFoo
{
public Foo(string state, ISomeDepedency dep){}
}
public interface IFooFactory
{
IFoo Create(string state);
}
[TestMethod]
public async Task TestLocationSearchHasResult()
{
var testVm = new GeocodeViewModel { SearchText = "Springerstraat Amersfoort Netherlands" };
await Deployment.Current.Dispatcher.InvokeTaskAsync(() => testVm.SearchLocation());
Assert.IsTrue(testVm.MapLocations.Any());
}
public static class DispatcherExtensions
{
public class DelegateCommand : DelegateCommand<object>
{
public DelegateCommand(Action executeMethod)
: base(o => executeMethod())
{
}
public DelegateCommand(Action executeMethod, Func<bool> canExecuteMethod)
: base(o => executeMethod(), o => canExecuteMethod())
{
public interface IRaiseCanExecuteChanged
{
void RaiseCanExecuteChanged();
}
// And an extension method to make it easy to raise changed events
public static class CommandExtensions
{
public static void RaiseCanExecuteChanged(this ICommand command)
{