public void Test__CircularDependency()
        {
            // Arrange
            var container = SimpleDependencyContainer.New().AddMap <ICircularDependency, CircularDependency>();

            // Act
            var exception = Record.Exception(() => container.Resolve <CircularDependency>());

            // Assert
            Assert.IsType <ArgumentException>(exception);
        }
        public void Test__TypeMap()
        {
            // Arrange
            var container = SimpleDependencyContainer.New().AddMap <IDummyInterface, DummyClass>();

            // Act
            var model = container.Resolve <ModelWithInterface>();

            // Assert
            Assert.NotNull(model);
        }
        public void Test__RegisterInstance()
        {
            // Arrange
            var expected  = _fixture.Create <FlatModelSource>();
            var container = SimpleDependencyContainer.New().RegisterInstance(expected);

            // Act
            var flatModelSource = container.Resolve <FlatModelSource>();

            // Assert
            Assert.Equal(expected, flatModelSource);
        }
        public void Test__ResolvableCircularDependency()
        {
            // Arrange
            var container = SimpleDependencyContainer.New();

            // Act
            var simple = container.Resolve <ResolvableCircularDependency>();
            var lazy   = container.Resolve <ResolvableCircularDependencyLazy>();
            var func   = container.Resolve <ResolvableCircularDependencyFunc>();

            // Assert
            Assert.NotNull(simple);
            Assert.NotNull(func.ResolvableCircularDependency());
            Assert.NotNull(lazy.ResolvableCircularDependency.Value);
        }
        public void Test__GetInstance()
        {
            // Arrange
            var expected  = _fixture.Create <FlatModelSource>();
            var container = SimpleDependencyContainer.New()
                            .RegisterDependency(x => x.SetType(typeof(FlatModelSource))
                                                .SetArgs(new object[] { expected.Name, expected.Age, expected.DateOfBith })
                                                .Compile());

            // Act
            var flatModelSource = container.Resolve <FlatModelSource>();

            // Assert
            Assert.Equal(expected, flatModelSource);
        }