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


C# System.Collections.Generic.SequenceEqual方法代码示例

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


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

示例1: CollectionExtensions_MapReduce_Map_EnumerableWithItems

        public void CollectionExtensions_MapReduce_Map_EnumerableWithItems()
        {
            var expected = new[] { 2, 4, 6, 8, 10, 12, 14, 16, 18 };
            var result = _target.Map(i => i * 2);

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

示例2: TestUbuntu1004

        public void TestUbuntu1004()
        {
            string filePath = Path.GetFullPath(@"../../../BencodeLibrary_Test/Resources/Ubuntu.torrent");
            Assert.IsTrue(File.Exists(filePath), "Test file missing");

            BDict torrentFile = BencodingUtils.DecodeFile(filePath) as BDict;

            // Check various aspects
            Assert.AreEqual("http://tracker.thepiratebay.org/announce", (torrentFile["announce"] as BString).Value);
            Assert.AreEqual("Torrent downloaded from http://thepiratebay.org", (torrentFile["comment"] as BString).Value);
            Assert.AreEqual(1272557269, (torrentFile["creation date"] as BInt).Value);

            BList announcelist = torrentFile["announce-list"] as BList;
            List<string> trackers = announcelist.OfType<BList>().Select(s => (s.First() as BString).Value).ToList();
            string[] expectedTrackers = new[] { "http://tracker.thepiratebay.org/announce", "udp://tracker.thepiratebay.org:80/announce", "http://torrent.ubuntu.com:6969/announce", "http://ipv6.torrent.ubuntu.com:6969/announce", "udp://tracker.openbittorrent.com:80/announce", "http://tracker.openbittorrent.com/announce" };

            Assert.IsTrue(expectedTrackers.SequenceEqual(trackers));

            BDict infoDict = torrentFile["info"] as BDict;
            Assert.AreEqual(733419520, (infoDict["length"] as BInt).Value);
            Assert.AreEqual(524288, (infoDict["piece length"] as BInt).Value);
            Assert.AreEqual("ubuntu-10.04-desktop-i386.iso", (infoDict["name"] as BString).Value);

            BString pieces = infoDict["pieces"] as BString;
            Assert.AreEqual(27980, pieces.Value.Length);
        }
开发者ID:parshikov,项目名称:BencodeLibrary,代码行数:26,代码来源:TestRealTorrents.cs

示例3: Verify_Data_Process_Method_FuzzBizz

 public void Verify_Data_Process_Method_FuzzBizz()
 {
     IEnumerable<string> expected = new[]
         {
             "1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"
         };
     Assert.IsTrue(expected.SequenceEqual(_h.FizzBuzz(1, 15)));
 }
开发者ID:Kamalswami,项目名称:FizzBuzz,代码行数:8,代码来源:HelperTests.cs

示例4: ConstructedWithEnumerableBehaviorExpectationsIsCorrect

 public void ConstructedWithEnumerableBehaviorExpectationsIsCorrect()
 {
     // Fixture setup
     var expectations = new[] { new DelegatingBehaviorExpectation(), new DelegatingBehaviorExpectation(), new DelegatingBehaviorExpectation() }.Cast<IBehaviorExpectation>();
     var sut = new CompositeBehaviorExpectation(expectations);
     // Exercise system
     var result = sut.BehaviorExpectations;
     // Verify outcome
     Assert.True(expectations.SequenceEqual(result));
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:11,代码来源:CompositeBehaviorExpectationTest.cs

示例5: YieldEnumeratorOfClaims

        public void YieldEnumeratorOfClaims()
        {
            var expected = new[]
                {
                    new Claim("foo", "bar"),
                    new Claim("queue", "qux"),
                    new Claim("Rafael", "Ricardo")
                };

            var sut = new SimpleWebToken(expected);

            Assert.True(expected.SequenceEqual(sut));
            Assert.True(expected.Cast<object>().SequenceEqual(sut.OfType<object>()));
        }
开发者ID:Rafael-Miceli,项目名称:SabadoTenDojo,代码行数:14,代码来源:SimpleWebTokenTests.cs

示例6: ConstructedWithEnumerableIdiomaticAssertionsIsCorrect

        public void ConstructedWithEnumerableIdiomaticAssertionsIsCorrect()
        {
            // Fixture setup
            IEnumerable<IIdiomaticAssertion> assertions = new[]
            {
                new DelegatingIdiomaticAssertion(),
                new DelegatingIdiomaticAssertion(),
                new DelegatingIdiomaticAssertion()
            }.AsEnumerable();

            var sut = new CompositeIdiomaticAssertion(assertions);
            // Exercise system
            var result = sut.Assertions;
            // Verify outcome
            Assert.True(assertions.SequenceEqual(result));
            // Teardown
        }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:17,代码来源:CompositeIdiomaticAssertionTest.cs

示例7: DeleteRangeTest

      public void DeleteRangeTest() {
         var initialRange = new SectorRange(0, 1000);
         var initialSector = CreateMock<ISector>();
         var chopRange = new SectorRange(250, 750);
         var leftSector = CreateMock<ISector>();
         var leftRange = new SectorRange(0, 250);
         var rightSector = CreateMock<ISector>();
         var rightRange = new SectorRange(750, 1000);
         var leftAndRightRange = new[] { leftRange, rightRange };
         var leftAndRightSectors = new[] { leftSector, rightSector };
         var leftAndRightRangeAndSectors = new[] { leftRange.PairValue(leftSector), rightRange.PairValue(rightSector) };

         When(initialSector.Segment(Eq(initialRange), EqSequence(leftAndRightRange))).ThenReturn(leftAndRightRangeAndSectors);

         var collection = new SectorCollection(new KeyValuePair<SectorRange, ISector>(initialRange, initialSector).Wrap());
         collection.DeleteRange(chopRange);

         Verify(initialSector).Segment(Eq(initialRange), Any<IEnumerable<SectorRange>>(x => x.SequenceEqual(leftAndRightRange)));
         VerifyNoMoreInteractions();

         AssertTrue(leftAndRightSectors.SequenceEqual(collection.EnumerateSectors()));
      }
开发者ID:ItzWarty,项目名称:Dargon.VirtualFileMaps,代码行数:22,代码来源:SectorCollectionTests.cs

示例8: ValuesAreCorrectWhenConstructedWithExplicitAutoDataAttribute

 public void ValuesAreCorrectWhenConstructedWithExplicitAutoDataAttribute()
 {
     // Fixture setup
     var dummyAutoDataAttribute = new AutoDataAttribute();
     var expectedValues = new[] { new object(), new object(), new object() };
     var sut = new InlineAutoDataAttribute(dummyAutoDataAttribute, expectedValues);
     // Exercise system
     var result = sut.Values;
     // Verify outcome
     Assert.True(expectedValues.SequenceEqual(result));
     // Teardown
 }
开发者ID:RyanLiu99,项目名称:AutoFixture,代码行数:12,代码来源:InlineAutoDataAttributeTest.cs

示例9: cant_edit_IEnumerable_int

 public void cant_edit_IEnumerable_int()
 {
     IEnumerable<int> sut = new [] {1};
     sut.ToArray()[0] = 2;
     Assert.IsFalse(sut.SequenceEqual(new []{2}));
 }
开发者ID:bjornebjornson,项目名称:LottoNh2,代码行数:6,代码来源:_IEnumerableIntersect.cs

示例10: List_Manipulate_Rotate

		public void List_Manipulate_Rotate()
		{
			var arr = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

			int shiftl = -3;

			//left shift
			_.List.Rotate(arr, shiftl);

			Assert.IsTrue(arr.SequenceEqual(new[] { 3, 4, 5, 6, 7, 8, 9, 0, 1, 2 }));


			//right shift back to normal
			_.List.Rotate(arr, -shiftl);

			Assert.IsTrue(arr.SequenceEqual(new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }));


			var shiftr = 5;
			//right shift again
			_.List.Rotate(arr, shiftr);

			Assert.IsTrue(arr.SequenceEqual(new[] { 5, 6, 7, 8, 9, 0, 1, 2, 3, 4 }));



			shiftl = -12;
			//testing overflow shift
			//should be equiv to shift two left
			_.List.Rotate(arr, shiftl);
			Assert.IsTrue(arr.SequenceEqual(new[] { 7, 8, 9, 0, 1, 2, 3, 4, 5, 6 }));

			shiftr = 15;
			//should be equiv to shift two right
			_.List.Rotate(arr, shiftr);
			Assert.IsTrue(arr.SequenceEqual(new[] { 2, 3, 4, 5, 6, 7, 8, 9, 0, 1 }));
		}
开发者ID:konkked,项目名称:Underscore.cs,代码行数:37,代码来源:ManipulateTest.cs

示例11: WritePrimitiveCollectionPropertyAsAvroTest

        public void WritePrimitiveCollectionPropertyAsAvroTest()
        {
            var expected = new[] { 3, 4 };
            var value = new ODataCollectionValue { Items = expected };

            ODataProperty prop = new ODataProperty
            {
                Name = "prop1",
                Value = value
            };

            MemoryStream ms = new MemoryStream();
            this.CreateOutputContext(ms).WriteProperty(prop);
            ms.Flush();
            ms.Seek(0, SeekOrigin.Begin);

            IEnumerable<object> results = null;

            using (var reader = AvroContainer.CreateGenericReader(ms))
            using (var seqReader = new SequentialReader<object>(reader))
            {
                results = seqReader.Objects;
            }

            var records = results.Cast<object[]>().ToList();
            Assert.AreEqual(1, records.Count());
            Assert.IsTrue(expected.SequenceEqual(records[0].Cast<int>()));
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:28,代码来源:ODataAvroWriterTests.cs

示例12: Sequence

 public void Sequence() {
     var ints = new[] { 0, 1, 2, 3 };
     Assert.That(ints.SequenceEqual(new[] {0, 1, 2, 3}), Is.True);
 }
开发者ID:slieser,项目名称:sandbox,代码行数:4,代码来源:CollectionTests.cs

示例13: GetFilesWithContinuationMarker

        public void GetFilesWithContinuationMarker()
        {
            //Arrange
            var response1 = new ListObjectsResponse { IsTruncated = true, NextMarker = "marker1" };
            response1.S3Objects.AddRange(new [] {
                new S3Object { Key = "media/object1" },
                new S3Object { Key = "media/object2" }
            });
            var response2 = new ListObjectsResponse { IsTruncated = false };
            response2.S3Objects.AddRange(new [] {
                new S3Object { Key = "media/object3" },
                new S3Object { Key = "media/object4" }
            });

            var clientMock = new Mock<IAmazonS3>();
            clientMock.Setup(p => p.ListObjects(It.Is<ListObjectsRequest>(req => req.Prefix == "media/1001/" && req.Delimiter == "/" && req.Marker == null)))
                      .Returns(response1);
            clientMock.Setup(p => p.ListObjects(It.Is<ListObjectsRequest>(req => req.Prefix == "media/1001/" && req.Delimiter == "/" && req.Marker == "marker1")))
                      .Returns(response2);

            var provider = CreateProvider(clientMock);

            //Act
            var actual = provider.GetFiles("1001/");

            //Assert
            var expected = new[] { "object1", "object2", "object3", "object4" };
            Assert.IsTrue(expected.SequenceEqual(actual));
            clientMock.VerifyAll();
        }
开发者ID:ElijahGlover,项目名称:Umbraco-S3-Provider,代码行数:30,代码来源:BucketFileSystemAbsoluteTests.cs

示例14: GetDirectoriesWithContinuationMarker

        public void GetDirectoriesWithContinuationMarker()
        {
            //Arrange
            var response1 = new ListObjectsResponse { IsTruncated = true, NextMarker = "Marker1" };
            response1.CommonPrefixes.AddRange(new[] { "media/1001/", "media/1002/", "media/1003/" });

            var response2 = new ListObjectsResponse { IsTruncated = false };
            response2.CommonPrefixes.AddRange(new[] { "media/1004/", "media/1005/", "media/1006/" });

            var clientMock = new Mock<IAmazonS3>();
            clientMock.Setup(p => p.ListObjects(It.Is<ListObjectsRequest>(req => req.Prefix == "media/" && req.Delimiter == "/" && req.Marker == null)))
                      .Returns(response1);
            clientMock.Setup(p => p.ListObjects(It.Is<ListObjectsRequest>(req => req.Prefix == "media/" && req.Delimiter == "/" && req.Marker == "Marker1")))
                      .Returns(response2);

            var provider = CreateProvider(clientMock);

            //Act
            var actual = provider.GetDirectories("/");

            //Assert
            var expected = new[] { "1001", "1002", "1003", "1004", "1005", "1006" };
            Assert.IsTrue(expected.SequenceEqual(actual));
            clientMock.VerifyAll();
        }
开发者ID:ElijahGlover,项目名称:Umbraco-S3-Provider,代码行数:25,代码来源:BucketFileSystemAbsoluteTests.cs

示例15: GetDirectories

        public void GetDirectories()
        {
            //Arrange
            var response = new ListObjectsResponse { IsTruncated = false };
            response.CommonPrefixes.AddRange(new[] { "media/1010/", "media/1011/", "media/1012/" });

            var clientMock = new Mock<IAmazonS3>();
            clientMock.Setup(p => p.ListObjects(It.Is<ListObjectsRequest>(req => req.Delimiter == "/" && req.Prefix == "media/")))
                      .Returns(response);

            var provider = CreateProvider(clientMock);

            //Act
            var actual = provider.GetDirectories("/");

            //Assert
            var expected = new[] {"1010", "1011", "1012"};
            Assert.IsTrue(expected.SequenceEqual(actual));
            clientMock.VerifyAll();
        }
开发者ID:ElijahGlover,项目名称:Umbraco-S3-Provider,代码行数:20,代码来源:BucketFileSystemAbsoluteTests.cs


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