public void Test_MinMaxBothZero() { CountSpecification s = new CountSpecification(0, 0, null); Assert.IsTrue(s.Test(new int[] {}).Success); Assert.IsFalse(s.Test(new int[] { 1 }).Success); Assert.IsFalse(s.Test(new int[] { 1, 2 }).Success); }
public void Test_MinMaxRange1() { CountSpecification s = new CountSpecification(1, 2, null); Assert.IsFalse(s.Test(new int[] { }).Success); Assert.IsTrue(s.Test(new int[] { 1 }).Success); Assert.IsTrue(s.Test(new int[] { 1, 2 }).Success); Assert.IsFalse(s.Test(new int[] { 1, 2, 3 }).Success); }
public void Test_MinMaxBothLargest() { // this should always be false unless someone has fills an array with MaxValue items CountSpecification s = new CountSpecification(int.MaxValue, int.MaxValue, null); Assert.IsFalse(s.Test(new int[] { }).Success); Assert.IsFalse(s.Test(new int[] { 1 }).Success); Assert.IsFalse(s.Test(new int[] { 1, 2 }).Success); }
public void Test_Filter() { CountSpecification s1 = new CountSpecification(1, 1, AlwaysTrue); Assert.IsFalse(s1.Test(new int[] { }).Success); Assert.IsTrue(s1.Test(new int[] { 1 }).Success); Assert.IsFalse(s1.Test(new int[] { 1, 2 }).Success); CountSpecification s2 = new CountSpecification(1, 1, AlwaysFalse); Assert.IsFalse(s2.Test(new int[] { }).Success); Assert.IsFalse(s2.Test(new int[] { 1 }).Success); Assert.IsFalse(s2.Test(new int[] { 1, 2 }).Success); }
public void Test_NonEnumerable() { CountSpecification s = new CountSpecification(1, 1, null); // testing an object that does not implement IEnumerable should throw Assert.IsFalse(s.Test(new object()).Success); }