public void ShouldThrowExceptionForDirectCyclicDependencies() { var coDependant1 = new TestDependant1(); var coDependant2 = new TestDependant1(); coDependant1.Requires(coDependant2); coDependant2.Requires(coDependant1); RunTest(new[] { coDependant1, coDependant2 }, c => { var ioex = Assert.Throws <InvalidOperationException>(() => Run(c)); Assert.IsType <DependencyException>(ioex.InnerException); }, dontConfigure: true); }
public void ShouldThrowExceptionForTransitiveCyclicDependencies() { var root = new TestDependant1(); var intermediate = new TestDependant1(); var dependant = new TestDependant1(); root.Requires(dependant); intermediate.Requires(root); dependant.Requires(intermediate); RunTest(new[] { root, intermediate, dependant }, c => { var ioex = Assert.Throws <InvalidOperationException>(() => Run(c)); Assert.IsType <DependencyException>(ioex.InnerException); }, dontConfigure: true); }