public void TestValidateAsCompositeWithCompositeInstallerAndAnotherCircularRef() { 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.ValidateAsComposite(_parentInstallers1); Assert.False(actual); }
public void TestValidateAsCompositeWithCompositeInstallerWithoutCircularRefDeep() { var compositeInstaller1 = new TestCompositeInstaller(); var compositeInstaller2 = new TestCompositeInstaller(); var compositeInstaller3 = new TestCompositeInstaller(); compositeInstaller1._leafInstallers = new List <TestInstaller> { _dummyInstaller1, compositeInstaller2, _dummyInstaller2, }; compositeInstaller2._leafInstallers = new List <TestInstaller> { compositeInstaller3, }; compositeInstaller3._leafInstallers = new List <TestInstaller> { _dummyInstaller3, }; bool actual = compositeInstaller1.ValidateAsComposite(_parentInstallers1); Assert.True(actual); }
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); }