summaryrefslogtreecommitdiff
path: root/product/DataAccess/Transactions/ContextFactorySpecs.cs
blob: 63a5accd715fe2f42b669fc66a461e8f6d6746fd (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
using System.Collections;
using developwithpassion.bdd.contexts;
using Gorilla.Commons.Testing;

namespace MoMoney.DataAccess.Transactions
{
    public class ContextFactorySpecs
    {
        [Concern(typeof (ContextFactory))]
        public class when_creating_a_new_context : concerns_for<IContextFactory, ContextFactory>
        {
            context c = () =>
            {
                scope = an<IScopedStorage>();
                storage = an<IDictionary>();

                when_the(scope).is_told_to(x => x.provide_storage()).it_will_return(storage);
            };

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

            it should_return_a_context_that_represents_the_specified_scope =
                () => result.should_be_an_instance_of<Context>();

            static IDictionary storage;
            static IScopedStorage scope;
            static IContext result;
        }
    }
}