2009 Advent Calendar December 11th
Like yesterday I only have a passing test to add today:
1: public class Given_two_transactions_from_the_same_ImportantProvider
2: {
3: private ImportantProvider _importantProvider;
4: private Transaction _transaction1;
5: private Transaction _transaction2;
6:
7: public Given_two_transactions_from_the_same_ImportantProvider()
8: {
9: _importantProvider = new ImportantProvider(new DummyObject());
10: _transaction1 = _importantProvider.Transaction;
11: _transaction2 = _importantProvider.Transaction;
12: }
13:
14: [Fact]
15: void It_should_be_two_different_transactions()
16: {
17: Assert.NotSame(_transaction1, _transaction2);
18: }
19:
20: [Fact]
21: void It_should_be_the_same_ImportantObject_returned_by_both_transactions()
22: {
23: Assert.Same(_transaction1.ImportantObject, _transaction2.ImportantObject);
24: }
25: }
You might have noticed that the ImportantProvider creates a new lock for each transaction. That is no good. Tomorrow I'll fix that.