Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created July 6, 2010 23:00
Show Gist options
  • Save jfromaniello/466051 to your computer and use it in GitHub Desktop.
Save jfromaniello/466051 to your computer and use it in GitHub Desktop.
using System;
using NUnit.Framework;
using SharpTestsEx;
using Suaquia.Tests.SampleDomain;
using Suquia;
namespace Suaquia.Tests
{
[TestFixture]
public class DependencyExamples
{
private ObjectMother objectMother;
[SetUp]
public void SetUpMother()
{
objectMother = new ObjectMother();
objectMother.AddMother("John", () => new Person{Name = "John"});
objectMother.AddMother("Milk", () => new Product{Name = "Milk", Price = 2m});
objectMother.AddMother("JohnOrderTwoMilks", () => new Order
{
Customer = objectMother.Create<Person>("John"),
Product = objectMother.Create<Product>("Milk"),
Date = new DateTime(2010,4,4),
Quantity = 2
});
}
[Test]
public void CanGetTheOrder()
{
var order = objectMother.Create<Order>("JohnOrderTwoMilks");
order.Customer.Name.Should().Be.EqualTo("John");
order.Product.Name.Should().Be.EqualTo("Milk");
order.Quantity.Should().Be.EqualTo(2m);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment