summaryrefslogtreecommitdiff
path: root/product/database/transactions/PerThreadScopedStorageSpecs.cs
blob: 2f072a3073a0a7bb778e8ee14ebe797bcea859d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections;
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;

namespace momoney.database.transactions
{
    public class PerThreadScopedStorageSpecs
    {
        [Concern(typeof (PerThreadScopedStorage))]
        public class when_retrieving_the_storage_for_a_specific_thread :
            concerns_for<IScopedStorage, PerThreadScopedStorage>
        {
            context c = () =>
            {
                thread = the_dependency<IThread>();
                storage = new Hashtable();
                when_the(thread)
                    .is_told_to(x => x.provide_slot_for<Hashtable>())
                    .it_will_return(storage);
            };

            because b = () =>
            {
                result = sut.provide_storage();
            };

            it should_return_the_storage_the_corresponds_to_the_current_thread = () => result.should_be_equal_to(storage);

            static IDictionary result;
            static IThread thread;
            static Hashtable storage;
        }
    }
}