コード例 #1
0
        public void RecordFieldUtility_GetField_12()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, 'a', "SubA");
            Assert.AreEqual(1, fields.Length);
        }
コード例 #2
0
        public void RecordFieldUtility_GetField_4()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();
            RecordField field = RecordFieldUtility.GetField(enumeration, 100, 0);

            Assert.IsNotNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, 100, 1);
            Assert.IsNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, 1000, 0);
            Assert.IsNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, 200, 0);
            Assert.IsNotNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, 200, 1);
            Assert.IsNotNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, 200, 2);
            Assert.IsNull(field);
        }
コード例 #3
0
        public void RecordFieldUtility_GetField_15()
        {
            IEnumerable <RecordField> enumeration    = _GetFieldEnumeration();
            Func <RecordField, bool>  fieldPredicate = field => field.Tag < 200;

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, fieldPredicate);
            Assert.AreEqual(2, fields.Length);
        }
コード例 #4
0
        public void RecordFieldUtility_GetField_8()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();
            Func <SubField, bool>     predicate   = subField => subField.Code == 'a';

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, predicate);
            Assert.AreEqual(1, fields.Length);
        }
コード例 #5
0
        public void RecordFieldUtility_GetField_14()
        {
            IEnumerable <RecordField> enumeration       = _GetFieldEnumeration();
            Func <RecordField, bool>  fieldPredicate    = field => field.Tag < 200;
            Func <SubField, bool>     subFieldPredicate = subField => subField.Code < 'c';

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, fieldPredicate, subFieldPredicate);
            Assert.AreEqual(1, fields.Length);
        }
コード例 #6
0
        public void RecordFieldUtility_GetField_11()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();

            char[]        codes  = { 'a', 'b' };
            string[]      values = { "SubA" };
            RecordField[] fields = RecordFieldUtility.GetField(enumeration, codes, values);
            Assert.AreEqual(1, fields.Length);
        }
コード例 #7
0
        public void RecordFieldUtility_GetField_9()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();

            char[] codes = { 'a', 'b' };
            Func <SubField, bool> predicate = subField => subField.Value.Contains("Sub");

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, codes, predicate);
            Assert.AreEqual(1, fields.Length);
        }
コード例 #8
0
        public void RecordFieldUtility_GetField_7()
        {
            int subFieldCount = 0;
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();
            Action <SubField>         action      = suField => { subFieldCount++; };

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, action);
            Assert.AreEqual(4, fields.Length);
            Assert.AreEqual(20, subFieldCount);
        }
コード例 #9
0
        public void RecordFieldUtility_GetField_5()
        {
            int count = 0;
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();
            Action <RecordField>      action      = field => { count++; };

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, action);
            Assert.AreEqual(4, fields.Length);
            Assert.AreEqual(4, count);
        }
コード例 #10
0
        public void RecordFieldUtility_GetField_1()
        {
            RecordFieldCollection collection = _GetFieldCollection();

            RecordField[] fields = RecordFieldUtility.GetField(collection, 100);
            Assert.AreEqual(1, fields.Length);

            fields = RecordFieldUtility.GetField(collection, 1000);
            Assert.AreEqual(0, fields.Length);
        }
コード例 #11
0
        public void RecordFieldUtility_GetField_3()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();

            RecordField[] fields = RecordFieldUtility.GetField(enumeration, 100);
            Assert.AreEqual(1, fields.Length);

            enumeration = _GetFieldEnumeration();
            fields      = RecordFieldUtility.GetField(enumeration, 1000);
            Assert.AreEqual(0, fields.Length);
        }
コード例 #12
0
        public void RecordFieldUtility_GetField_18()
        {
            RecordFieldCollection collection = _GetFieldCollection();

            int[]       tags  = { 100, 200 };
            RecordField field = RecordFieldUtility.GetField(collection, tags, 1);

            Assert.IsNotNull(field);

            field = RecordFieldUtility.GetField(collection, tags, 10);
            Assert.IsNull(field);
        }
コード例 #13
0
        public void RecordFieldUtility_GetField_16()
        {
            IEnumerable <RecordField> enumeration = _GetFieldEnumeration();

            int[]       tags  = { 100, 200 };
            RecordField field = RecordFieldUtility.GetField(enumeration, tags, 0);

            Assert.IsNotNull(field);

            enumeration = _GetFieldEnumeration();
            field       = RecordFieldUtility.GetField(enumeration, tags, 10);
            Assert.IsNull(field);
        }
コード例 #14
0
        public void RecordFieldUtility_GetField_17()
        {
            RecordFieldCollection    collection = _GetFieldCollection();
            Func <RecordField, bool> predicate  = field => field.HaveSubField('a');

            RecordField[] fields = RecordFieldUtility.GetField(collection, predicate);
            Assert.AreEqual(1, fields.Length);

            predicate = field => field.HaveSubField('j');
            fields    = RecordFieldUtility.GetField(collection, predicate);
            Assert.AreEqual(1, fields.Length);

            predicate = field => field.HaveSubField('x');
            fields    = RecordFieldUtility.GetField(collection, predicate);
            Assert.AreEqual(0, fields.Length);
        }
コード例 #15
0
        public void RecordFieldUtility_GetField_2()
        {
            RecordFieldCollection collection = _GetFieldCollection();
            RecordField           field      = RecordFieldUtility.GetField(collection, 100, 0);

            Assert.IsNotNull(field);

            field = RecordFieldUtility.GetField(collection, 100, 1);
            Assert.IsNull(field);

            field = RecordFieldUtility.GetField(collection, 1000, 0);
            Assert.IsNull(field);

            field = RecordFieldUtility.GetField(collection, 200, 0);
            Assert.IsNotNull(field);

            field = RecordFieldUtility.GetField(collection, 200, 1);
            Assert.IsNotNull(field);

            field = RecordFieldUtility.GetField(collection, 200, 2);
            Assert.IsNull(field);
        }