Exemple #1
0
        public void NotRegister()
        {
            var collector = new AssignableCollector(_contract, DependencyLifetime.Scoped);

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

            _collection.Contains(_contract).Should().BeFalse();
        }
Exemple #2
0
        public void RegisterWithValidLifetime(DependencyLifetime lifetime)
        {
            var collector = new AssignableCollector(_contract, lifetime);

            collector.TryRegister(_collection, _implementation);

            var dependency = _collection.GetRequiredDependency(_contract);

            dependency.Lifetime.Should().Be(lifetime);
        }
Exemple #3
0
        public void Register()
        {
            var collector = new AssignableCollector(_contract, DependencyLifetime.Singleton);

            collector.TryRegister(_collection, _implementation);

            var dependency = _collection.GetRequiredDependency(_contract);

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