public void AddInspectorsWorks() { var env = new Ex.Env(); var i1 = new Mocks.Inspector(); var i2 = new Mocks.Inspector(); var d = new Mocks.JailbreakDetector(env, new[] { i1, i2 }); var inspectors = d.GetInspectors(); Assert.Equal(2, inspectors.Count()); Assert.Same(i1, inspectors.First()); Assert.Same(i2, inspectors.Last()); }
public void AddInspectorsIsRobust() { var env = new Ex.Env(); // 1. empty list var d = new Mocks.JailbreakDetector(env, new IInspector[0]); var inspectors = d.GetInspectors(); Assert.Equal(0, inspectors.Count()); // 2. null list d = new Mocks.JailbreakDetector(null); inspectors = d.GetInspectors(); Assert.Equal(0, inspectors.Count()); // 3. null in otherwise empty list d = new Mocks.JailbreakDetector(env, new IInspector[] { null }); inspectors = d.GetInspectors(); Assert.Equal(0, inspectors.Count()); var i1 = new Mocks.Inspector(); // 4. null in otherwise non-empty list d = new Mocks.JailbreakDetector(env, new IInspector[] { null, i1, null }); inspectors = d.GetInspectors(); Assert.Equal(1, inspectors.Count()); Assert.Same(i1, inspectors.First()); }