예제 #1
0
        public void SomeItemTests()
        {
            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
            Ensure.That(mixed, Has.Some.Null);
            Ensure.That(mixed, Has.Some.InstanceOfType(typeof(int)));
            Ensure.That(mixed, Has.Some.InstanceOfType(typeof(string)));
            Ensure.That(strings, Has.Some.StartsWith("ba"));
            Ensure.That(strings, Has.Some.Not.StartsWith("ba"));

            // Inherited syntax
            EnsuranceHelper.Expect(mixed, Some.Null);
            EnsuranceHelper.Expect(mixed, Some.InstanceOfType(typeof(int)));
            EnsuranceHelper.Expect(mixed, Some.InstanceOfType(typeof(string)));
            EnsuranceHelper.Expect(strings, Some.StartsWith("ba"));
            EnsuranceHelper.Expect(strings, Some.Not.StartsWith("ba"));
        }