main
  1using System;
  2using System.Collections.Generic;
  3using System.Data;
  4using System.Windows.Forms;
  5using developwithpassion.bdd.contexts;
  6using Gorilla.Commons.Infrastructure.Container;
  7using gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration;
  8using Gorilla.Commons.Testing;
  9using gorilla.commons.utility;
 10using MoMoney.Domain.Core;
 11
 12namespace MoMoney.boot.container
 13{
 14    public abstract class behaves_like_component_exclusion_specification :
 15        concerns_for<ComponentExclusionSpecification, ComponentExclusionSpecificationImplementation> {}
 16
 17    public class when_checking_if_a_windows_form_should_be_excluded : behaves_like_component_exclusion_specification
 18    {
 19        it should_be_excluded = () => result.should_be_true();
 20
 21        because b = () =>
 22        {
 23            result = sut.is_satisfied_by(typeof (FakeForm));
 24        };
 25
 26        static bool result;
 27    }
 28
 29    public class when_checking_if_a_dependency_registry_should_be_excluded :
 30        behaves_like_component_exclusion_specification
 31    {
 32        it should_be_excluded = () => result.should_be_true();
 33
 34        because b = () =>
 35        {
 36            result = sut.is_satisfied_by(typeof (FakeDependencyRegistry));
 37        };
 38
 39        static bool result;
 40    }
 41
 42    public class when_checking_if_a_static_class_should_be_excluded : behaves_like_component_exclusion_specification
 43    {
 44        it should_be_excluded = () => result.should_be_true();
 45
 46        because b = () =>
 47        {
 48            result = sut.is_satisfied_by(typeof (FakeStaticClass));
 49        };
 50
 51        static bool result;
 52    }
 53
 54    public class when_checking_if_an_domain_entity_should_be_excluded : behaves_like_component_exclusion_specification
 55    {
 56        it should_be_excluded = () => result.should_be_true();
 57
 58        because b = () =>
 59        {
 60            result = sut.is_satisfied_by(typeof (FakeEntity));
 61        };
 62
 63        static bool result;
 64    }
 65
 66    public class when_checking_if_an_interface_should_be_excluded : behaves_like_component_exclusion_specification
 67    {
 68        it should_be_excluded = () => result.should_be_true();
 69
 70        because b = () =>
 71        {
 72            result = sut.is_satisfied_by(typeof (IDbConnection));
 73        };
 74
 75        static bool result;
 76    }
 77
 78    public class FakeForm : Form {}
 79
 80    public class FakeDependencyRegistry : DependencyRegistry
 81    {
 82        public Interface get_a<Interface>()
 83        {
 84            throw new NotImplementedException();
 85        }
 86
 87        public IEnumerable<Contract> get_all<Contract>()
 88        {
 89            throw new NotImplementedException();
 90        }
 91    }
 92
 93    static public class FakeStaticClass {}
 94
 95    public class FakeEntity : Entity
 96    {
 97        public Id<Guid> id
 98        {
 99            get { throw new NotImplementedException(); }
100        }
101    }
102}