Beispiel #1
0
        public void TestValidateLeafInstallerWithCompositeInstallerAndAnotherCircularRef()
        {
            var installer1 = new TestCompositeInstaller();
            var installer2 = new TestCompositeInstaller();
            var installer3 = new TestCompositeInstaller();

            installer1._leafInstallers = new List <TestInstaller>
            {
                _dummyInstaller1,
                installer2,
                _dummyInstaller2,
            };
            installer2._leafInstallers = new List <TestInstaller>
            {
                installer3,
            };
            installer3._leafInstallers = new List <TestInstaller>
            {
                installer2,  // a circular reference
                _dummyInstaller3,
            };

            bool actual = installer1.ValidateLeafInstaller(_parentInstallers);

            Assert.False(actual);
        }
Beispiel #2
0
        public void TestValidateLeafInstallerWithCompositeInstallerWithoutCircularRefDeep()
        {
            var installer1 = new TestCompositeInstaller();
            var installer2 = new TestCompositeInstaller();
            var installer3 = new TestCompositeInstaller();

            installer1._leafInstallers = new List <TestInstaller>
            {
                _dummyInstaller1,
                installer2,
                _dummyInstaller2,
            };
            installer2._leafInstallers = new List <TestInstaller>
            {
                installer3,
            };
            installer3._leafInstallers = new List <TestInstaller>
            {
                _dummyInstaller3,
            };

            bool actual = installer1.ValidateLeafInstaller(_parentInstallers);

            Assert.True(actual);
        }
        public void TestValidateAsCompositeWithCompositeInstallerAndParentCircularRefDeep()
        {
            var installer1 = new TestCompositeInstaller();
            var installer2 = new TestCompositeInstaller();
            var installer3 = new TestCompositeInstaller();

            installer1._leafInstallers = new List <TestInstaller>
            {
                _dummyInstaller1,
                installer2,
                _dummyInstaller2,
            };
            installer2._leafInstallers = new List <TestInstaller>
            {
                installer3,
            };
            installer3._leafInstallers = new List <TestInstaller>
            {
                _compositeInstaller1,  // a circular reference
                _dummyInstaller3,
            };

            bool actual = installer1.ValidateAsComposite(_parentInstallers1);

            Assert.False(actual);
        }
Beispiel #4
0
        public void TestValidateLeafInstallerWithCompositeInstallerWithoutCircularRef()
        {
            var installer = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>(),
            };

            bool actual = installer.ValidateLeafInstaller(_parentInstallers);

            Assert.True(actual);
        }
Beispiel #5
0
        public void TestValidateLeafInstallerWithCompositeInstallerAndSelfCircularRef()
        {
            var installer = new TestCompositeInstaller();

            installer._leafInstallers = new List <TestInstaller>
            {
                installer,
            };

            bool actual = installer.ValidateLeafInstaller(_parentInstallers);

            Assert.False(actual);
        }
Beispiel #6
0
        public void SetUp()
        {
            _parentInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };

            _parentInstallers = new List <TestCompositeInstaller>
            {
                _parentInstaller1,
            };

            _dummyInstaller1 = new TestInstaller();
            _dummyInstaller2 = new TestInstaller();
            _dummyInstaller3 = new TestInstaller();
        }
        public void TestValidateAsCompositeWithCompositeInstallerAndParentCircularRef()
        {
            var installer = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>
                {
                    _compositeInstaller1,
                },
            };

            _parentInstallers1 = new List <TestCompositeInstaller>
            {
                _compositeInstaller1,
            };

            bool actual = installer.ValidateAsComposite(_parentInstallers1);

            Assert.False(actual);
        }
        public void SetUp()
        {
            _installer1 = new TestInstaller();

            _compositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
            _compositeInstaller2 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>
                {
                    _compositeInstaller1,
                },
            };

            _circularRefCompositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
            _circularRefCompositeInstaller1._leafInstallers.Add(_circularRefCompositeInstaller1);

            _parentInstallers1 = new List <TestCompositeInstaller>
            {
                _compositeInstaller1,
            };

            _dummyInstaller1 = new TestInstaller();
            _dummyInstaller2 = new TestInstaller();
            _dummyInstaller3 = new TestInstaller();

            _dummyCompositeInstaller1 = new TestCompositeInstaller
            {
                _leafInstallers = new List <TestInstaller>()
            };
        }