Created
July 6, 2010 23:00
-
-
Save jfromaniello/466051 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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