Ejemplo n.º 1
0
        private CharTestTable[] GetCharData([DataSources] string context)
        {
            var provider = GetProviderName(context, out var _);

            // filter out null-character test cases for servers/providers without support
            if (context.Contains(ProviderName.PostgreSQL) ||
                provider == ProviderName.DB2 ||
                provider == ProviderName.SqlCe ||
                context.Contains(ProviderName.SapHana))
            {
                return(CharTestData.Where(_ => _.NChar != '\0').ToArray());
            }

            // I wonder why
            if (context.Contains(ProviderName.Firebird))
            {
                return(CharTestData.Where(_ => _.NChar != '\xA0').ToArray());
            }

            // also strange
            if (context.Contains(TestProvName.AllInformix))
            {
                return(CharTestData.Where(_ => _.NChar != '\0' && (_.NChar ?? 0) < byte.MaxValue).ToArray());
            }

            return(CharTestData);
        }
Ejemplo n.º 2
0
        private static CharTestTable[] GetCharData(string context)
        {
            // filter out null-character test cases for servers/providers without support
            if (context == ProviderName.PostgreSQL ||
                context == ProviderName.PostgreSQL + ".LinqService" ||
                context == ProviderName.DB2 ||
                context == ProviderName.DB2 + ".LinqService" ||
                context == ProviderName.SqlCe ||
                context == ProviderName.SqlCe + ".LinqService" ||
                context == ProviderName.SapHana ||
                context == ProviderName.SapHana + ".LinqService")
            {
                return(CharTestData.Where(_ => _.NChar != '\0').ToArray());
            }

            // I wonder why
            if (context == ProviderName.Firebird ||
                context == ProviderName.Firebird + ".LinqService" ||
                context == TestProvName.Firebird3 ||
                context == TestProvName.Firebird3 + ".LinqService")
            {
                return(CharTestData.Where(_ => _.NChar != '\xA0').ToArray());
            }

            // also strange
            if (context == ProviderName.Informix ||
                context == ProviderName.Informix + ".LinqService")
            {
                return(CharTestData.Where(_ => _.NChar != '\0' && (_.NChar ?? 0) < byte.MaxValue).ToArray());
            }

            return(CharTestData);
        }
Ejemplo n.º 3
0
        public void Equals()
        {
            CharTestData[] testData = new CharTestData[]
            {
                new CharTestData((char)'a', (char)'a', true),
                new CharTestData((char)'a', (char)'A', false),
                new CharTestData((char)'a', (char)'b', false),
                new CharTestData((char)'a', (int)'a', false),
                new CharTestData((char)'a', "a", false),
                new CharTestData((char)'a', null, false)
            };

            foreach (var test in testData)
            {
                if (test.Obj is char)
                {
                    Assert.Equal(test.Expected, test.C.Equals((char)test.Obj));
                    Assert.Equal(test.Expected, test.C.GetHashCode().Equals(test.Obj.GetHashCode()));
                }

                Assert.Equal(test.Expected, test.C.Equals(test.Obj));
            }
        }