Skip to content

Instantly share code, notes, and snippets.

@horsdal
horsdal / gist:3073080
Created July 8, 2012 21:55
WPF binding smoke test template
[Fact]
public void Tag_is_bound_to_model_on_construction()
{
var model = new MainWindowViewModel(tag: "testing");
var sut = new MainWindow(model);
sut.Show();
var tag = sut.FindName("Tag") as TextBox;
Assert.Equal(model.Tag, tag.Text);
public class CourseTemplate
{
public int Limit { get; set; }
public string Description { get; set; }
}
public struct Course
{
public CourseTemplate Template { get; set; }
public bool IsMorning { get; set; }
public class Solution
{
public CourseList MoringCourses { get; private set; }
public CourseList AfternoonCourses { get; private set; }
public Solution(CourseList moringCourses, CourseList afternoonCourses)
{
AfternoonCourses = afternoonCourses;
MoringCourses = moringCourses;
}
var coursePlan = new CoursePlan(new CourseList(), new RegistrantList(), 5);
var solution = coursePlan.Solve();
public class CoursePlan
{
private IEnumerable<Course> courses;
private IEnumerable<Registrant> registrants;
private readonly int instructorCount;
public CoursePlan(IEnumerable<Course> courses, IEnumerable<Registrant> registrants, int instructorCount)
{
this.courses = courses;
this.registrants = registrants;
public class CourseTemplate
{
public int Limit { get; private set; }
public string Description { get; private set; }
public CourseTemplate(int limit, string description)
{
Description = description;
Limit = limit;
}
public class Registrant
{
private readonly List<Course> courseWishes = new List<Course>();
public IEnumerable<Course> CourseWishes { get { return courseWishes; } }
public string Name { get; private set; }
public Registrant(string name)
{
Name = name;
}
public class Course
{
private readonly List<Registrant> registrants = new List<Registrant>();
public CourseTemplate Template { get; private set; }
public bool IsMorning { get; private set; }
public IEnumerable<Registrant> Registrants { get { return registrants; } }
public bool IsFull { get { return Template.Limit < registrants.Count; } }
public bool IsEmpty { get { return registrants.Count == 0; } }
public class CoursePlan
{
private readonly IEnumerable<Course> courses;
private IEnumerable<Registrant> registrants;
private readonly int instructorCount;
public CoursePlan(IEnumerable<Course> courses, IEnumerable<Registrant> registrants, int instructorCount)
{
this.courses = courses;
this.registrants = registrants;
module HelloFsNancy =
open System
open Nancy
open Nancy.Hosting.Self
type HelloModule() as self =
inherit NancyModule()
do
self.Get.["/"] <-