public void Some_BeforeBinaryOperators() { var expression = Some.GreaterThan(0).And.LessThan(100).Or.EqualTo(999); Expect(expression, TypeOf <EqualConstraint>()); var constraint = Resolve(expression); Expect(constraint, TypeOf <SomeItemsConstraint>()); Expect(constraint.ToString(), EqualTo("<some <or <and <greaterthan 0> <lessthan 100>> <equal 999>>>")); }
public void Some_AndSome() { var expression = Some.GreaterThan(0).And.Some.LessThan(100); Expect(expression, TypeOf <LessThanConstraint>()); var constraint = Resolve(expression); Expect(constraint, TypeOf <AndConstraint>()); Expect(constraint.ToString(), EqualTo("<and <some <greaterthan 0>> <some <lessthan 100>>>")); }
public void SomeItemsTests() { object[] mixed = new object[] { 1, 2, "3", null, "four", 100 }; object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" }; // Not available using the classic syntax // Helper syntax Assert.That(mixed, Has.Some.Null); Assert.That(mixed, Has.Some.InstanceOfType(typeof(int))); Assert.That(mixed, Has.Some.InstanceOfType(typeof(string))); Assert.That(mixed, Has.Some.GreaterThan(99)); Assert.That(strings, Has.Some.StartsWith("ba")); Assert.That(strings, Has.Some.Not.StartsWith("ba")); // Inherited syntax Expect(mixed, Some.Null); Expect(mixed, Some.InstanceOfType(typeof(int))); Expect(mixed, Some.InstanceOfType(typeof(string))); Expect(mixed, Some.GreaterThan(99)); Expect(strings, Some.StartsWith("ba")); Expect(strings, Some.Not.StartsWith("ba")); }