当前位置: 首页>>代码示例>>C#>>正文


C# System.Linq.SequenceEqual方法代码示例

本文整理汇总了C#中System.Linq.SequenceEqual方法的典型用法代码示例。如果您正苦于以下问题:C# System.Linq.SequenceEqual方法的具体用法?C# System.Linq.SequenceEqual怎么用?C# System.Linq.SequenceEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Linq的用法示例。


在下文中一共展示了System.Linq.SequenceEqual方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_Shuffle

        public void Can_Shuffle()
        {
            var items = new[] {"Foo", "Bar", "Baz", "Boo", "Alexander", "Nyquist"};
            var shuffled = items.Shuffle();

            Assert.IsFalse(items.SequenceEqual(shuffled));
        }
开发者ID:alexandernyquist,项目名称:alexn,代码行数:7,代码来源:CollectionExtensions.cs

示例2: SequenceEqual_compares_items_using_provided_equality_function

        public void SequenceEqual_compares_items_using_provided_equality_function()
        {
            var first = new[] { "a", "A" };
            var second = new[] { "A", "a" };

            Assert.True(first.SequenceEqual(second, (a, b) => a.Equals(b, StringComparison.OrdinalIgnoreCase)));
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:DynamicEqualityComparerLinqIntegrationTests.cs

示例3: Test

        public static void Test(Assert assert)
        {
            assert.Expect(4);

            // TEST
            int[] numbersA = { 4, 1, 3 };
            int[] numbersB = { 2, 3, 5 };

            var concatNumbers = numbersA.Concat(numbersB);
            assert.DeepEqual(concatNumbers, new[] { 4, 1, 3, 2, 3, 5 }, "Concat() numbers");

            // TEST
            var names = from p in Person.GetPersons()
                        select p.Name;
            var cities = from p in Person.GetPersons()
                         select p.City;
            var concatNames = names.Concat(cities).ToArray();

            assert.DeepEqual(concatNames,
                            new[] { "Frank", "Zeppa", "John", "Billy", "Dora", "Ian", "Mary", "Nemo",
                                    "Edmonton", "Tokyo", "Lisbon", "Paris", "Budapest", "Rome", "Dortmund", "Ocean"},
                            "Concat() two sequences");

            // TEST
            var a = new[] { "a", "b", "z" };
            var b = new[] { "a", "b", "z" };

            assert.Ok(a.SequenceEqual(b), "SequenceEqual() for equal sequences");

            // TEST
            var c = new[] { "a", "b", "z" };
            var d = new[] { "a", "z", "b" };

            assert.Ok(!c.SequenceEqual(d), "SequenceEqual() for not equal sequences");
        }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:35,代码来源:TestLinqMiscellaneousOperators.cs

示例4: TranslationsFlatToTranslations

        public void TranslationsFlatToTranslations()
        {
            var arr = new[] {"Test1", "Test2"};
            var data = JsonConvert.SerializeObject(arr);
            var state = new WordState { TranslationsFlat=data};

            Assert.IsTrue(arr.SequenceEqual(state.Translations));
        }
开发者ID:uaavg,项目名称:langdb,代码行数:8,代码来源:WordStateTests.cs

示例5: ShouldApplyLimitUsingTop

        public void ShouldApplyLimitUsingTop()
        {
            var sql = "select a,b,c from d where a = 1 order by c";
            var expected = new[]{ "select top 5 a,b,c from d where a = 1 order by c"};

            var pagedSql = new VistaDBQueryPager().ApplyLimit(sql, 5);
            var modified = pagedSql.Select(x => Normalize.Replace(x, " ").ToLowerInvariant());

            Assert.IsTrue(expected.SequenceEqual(modified));
        }
开发者ID:markrendle,项目名称:Simple.Data.VistaDB,代码行数:10,代码来源:SqlQueryPagerTest.cs

示例6: ShouldCopeWithAliasedDefaultSortColumn

        public void ShouldCopeWithAliasedDefaultSortColumn()
        {
            var sql = "select [a] as [foo],[b],[c] from [d] where [a] = 1";
            var expected = new[]{
                "with __data as (select [a] as [foo],[b],[c], row_number() over(order by [a]) as [_#_] from [d] where [a] = 1)"
                + " select [foo],[b],[c] from __data where [_#_] between 31 and 40"};

            var pagedSql = new VistaDBQueryPager().ApplyPaging(sql, 30, 10);
            var modified = pagedSql.Select(x => Normalize.Replace(x, " ").ToLowerInvariant());

            Assert.IsTrue(expected.SequenceEqual(modified));
        }
开发者ID:markrendle,项目名称:Simple.Data.VistaDB,代码行数:12,代码来源:SqlQueryPagerTest.cs

示例7: ShouldApplyPagingUsingOrderByFirstColumnIfNotAlreadyOrdered

        public void ShouldApplyPagingUsingOrderByFirstColumnIfNotAlreadyOrdered()
        {
            var sql = "select a,b,c from d where a = 1";
            var expected = new[]{
                "with __data as (select a,b,c, row_number() over(order by a) as [_#_] from d where a = 1)"
                + " select a,b,c from __data where [_#_] between 11 and 30"};

            var pagedSql = new VistaDBQueryPager().ApplyPaging(sql, 10, 20);
            var modified = pagedSql.Select(x => Normalize.Replace(x, " ").ToLowerInvariant());

            Assert.IsTrue(expected.SequenceEqual(modified));
        }
开发者ID:markrendle,项目名称:Simple.Data.VistaDB,代码行数:12,代码来源:SqlQueryPagerTest.cs

示例8: GetAllTypesTest

		public void GetAllTypesTest (ModuleDefinition module)
		{
			var sequence = new [] {
				module.GetType ("<Module>"),
				module.GetType ("Foo"),
				module.GetType ("Foo/Bar"),
				module.GetType ("Foo/Gazonk"),
				module.GetType ("Foo/Gazonk/Baz"),
				module.GetType ("Pan"),
			};

			Assert.IsTrue (sequence.SequenceEqual (module.GetAllTypes ()));
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:13,代码来源:ModuleDefinitionRocksTests.cs

示例9: ShouldReturnFilePath

        public void ShouldReturnFilePath()
        {
            var root = Client.GetFolder(FolderID.Root).ID;
            var parent = Client.CreateFolder(root, "TestGetFileParent").ID;
            var name = "TestGetFile";
            var file = Client.CreateFile(parent, name).ID;
            var path = new[] { root, parent };

            var filePath = Client.GetFilePath(file);

            Assert.IsNotNull(filePath);
            Assert.IsTrue(path.SequenceEqual(filePath.Folders.Select(folder => folder.ID)));
        }
开发者ID:aerofs,项目名称:aerofs-sdk-csharp,代码行数:13,代码来源:TestGetFilePath.cs

示例10: GetAllTypesTest

        public void GetAllTypesTest()
        {
            TestCSharp ("Types.cs", module => {
                var sequence = new [] {
                module.GetType ("<Module>"),
                module.GetType ("Foo"),
                module.GetType ("Foo/Bar"),
                module.GetType ("Foo/Gazonk"),
                module.GetType ("Foo/Gazonk/Baz"),
                module.GetType ("Pan"),
            };

                Assert.IsTrue (sequence.SequenceEqual (module.GetAllTypes ()));
            });
        }
开发者ID:ttRevan,项目名称:cecil,代码行数:15,代码来源:ModuleDefinitionRocksTests.cs

示例11: CollectionExtensions_Creation_Snapshot

        public void CollectionExtensions_Creation_Snapshot()
        {
            var expected = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            var result = _target.Select(x => x).Snapshot();
            var resultValue = result();

            Assert.IsTrue(_target.SequenceEqual(resultValue));

            for (int i = 0; i < _target.Length; i++)
                _target[i] *= 2;

            resultValue = result();

            Assert.IsTrue(expected.SequenceEqual(resultValue));
        }
开发者ID:konkked,项目名称:Underscore.cs,代码行数:15,代码来源:CreationTest.cs

示例12: GetOverridenCspPluginTypesConfig_NoMediaTypesOverride_KeepsMediaTypes

        public void GetOverridenCspPluginTypesConfig_NoMediaTypesOverride_KeepsMediaTypes()
        {
            var expectedMediaTypes = new[] { "application/pdf" };
            var directiveConfig = new CspPluginTypesDirectiveConfiguration { MediaTypes = expectedMediaTypes };
            var directiveOverride = new CspPluginTypesOverride { InheritMediaTypes = true };

            var newConfig = _overrideHelper.GetOverridenCspPluginTypesConfig(directiveOverride, directiveConfig);

            Assert.IsTrue(expectedMediaTypes.SequenceEqual(newConfig.MediaTypes), "MediaTypes differed.");
        }
开发者ID:modulexcite,项目名称:NWebsec,代码行数:10,代码来源:CspDirectiveOverrideHelperTests.cs

示例13: GetOverridenCspDirectiveConfig_NoCustomSourcesOverride_KeepsCustomSources

        public void GetOverridenCspDirectiveConfig_NoCustomSourcesOverride_KeepsCustomSources()
        {
            var expectedSources = new[] { "www.nwebsec.com" };
            var directiveConfig = new CspDirectiveConfiguration { CustomSources = expectedSources };
            var directiveOverride = new CspDirectiveOverride { InheritOtherSources = true };

            var newConfig = _overrideHelper.GetOverridenCspDirectiveConfig(directiveOverride, directiveConfig);

            Assert.IsTrue(expectedSources.SequenceEqual(newConfig.CustomSources), "CustomSources differed.");
        }
开发者ID:modulexcite,项目名称:NWebsec,代码行数:10,代码来源:CspDirectiveOverrideHelperTests.cs


注:本文中的System.Linq.SequenceEqual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。