Ejemplo n.º 1
0
        public void NotRegister()
        {
            var collector = new GenericInterfaceCollector(_contract, DependencyLifetime.Singleton);

            collector.TryRegister(_collection, typeof(Boo));

            _collection.Contains(_contract).Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void RegisterWithValidLifetime(DependencyLifetime lifetime)
        {
            var collector = new GenericInterfaceCollector(_contract, lifetime);

            collector.TryRegister(_collection, _implementation);

            var dependency = _collection.GetRequiredDependency(_contractImplementation);

            dependency.Lifetime.Should().Be(lifetime);
        }
Ejemplo n.º 3
0
        public void Register()
        {
            var collector = new GenericInterfaceCollector(_contract, DependencyLifetime.Singleton);

            collector.TryRegister(_collection, _implementation);

            var dependency = _collection.GetRequiredDependency(_contractImplementation);

            dependency.Contracts.Should().Contain(_contractImplementation);
            dependency.Implementation.Should().Be(_implementation);
            dependency.Applicable(_contractImplementation).Should().BeTrue();
        }