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


C# ArrayStack.ToArray方法代码示例

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


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

示例1: ConvertEmptyStackToArray

 public void ConvertEmptyStackToArray()
 {
     ArrayStack<int> arrayStack = new ArrayStack<int>();
     int [] expected= new int[0];
     int[] actual = arrayStack.ToArray();
     CollectionAssert.AreEqual(expected, actual);
 }
开发者ID:dhristoskov,项目名称:DateStructure,代码行数:7,代码来源:ArrayStackTest.cs

示例2: TestEmptyStackToArray_ShouldReturnEmptyArray

 public void TestEmptyStackToArray_ShouldReturnEmptyArray()
 {
     var stack = new ArrayStack<DateTime>();
     var array = stack.ToArray();
     var expected = new DateTime[0];
     CollectionAssert.AreEqual(expected, array);
 }
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:7,代码来源:UnitTest1.cs

示例3: EmptyStackToArray

        public void EmptyStackToArray()
        {
            var stack = new ArrayStack<DateTime>();
            var testArr = new DateTime[0];

            CollectionAssert.AreEqual(testArr, stack.ToArray());
        }
开发者ID:Aleksandyr,项目名称:Software-University,代码行数:7,代码来源:ArrayStackUnitTest.cs

示例4: TestEmptyStackToArray

        public void TestEmptyStackToArray()
        {
            var stack = new ArrayStack<DateTime>();
            DateTime[] array = stack.ToArray();

            Assert.AreEqual(0, array.Length);
        }
开发者ID:bobosam,项目名称:DataStructures,代码行数:7,代码来源:ArrayStackTests.cs

示例5: EmptyStackToArray_ShouldReturnEmptyArray

        public void EmptyStackToArray_ShouldReturnEmptyArray()
        {
            var stack = new ArrayStack<DateTime>();

            var actual = stack.ToArray().Length;
            Assert.AreEqual(0, actual, "Array is not empty.");
        }
开发者ID:vangelov-i,项目名称:Fundamentals,代码行数:7,代码来源:Array-Based-Stack.Tests.cs

示例6: ToArray_EmptyStack_ShouldReturnEmptyArray

        public void ToArray_EmptyStack_ShouldReturnEmptyArray()
        {
            var stack = new ArrayStack<DateTime>();

            var arr = stack.ToArray();

            CollectionAssert.AreEqual(new DateTime [] {}, arr);
        }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:8,代码来源:ToArrayTest.cs

示例7: EmptyStackToArray_ArrayShouldBeEmpty

        public void EmptyStackToArray_ArrayShouldBeEmpty()
        {
            var stack = new ArrayStack<int>();

            var array = stack.ToArray();

            Assert.AreEqual(0, array.Length);
        }
开发者ID:stoian2662,项目名称:Data-Structures-And-Algorithms,代码行数:8,代码来源:UnitTestsArrayBasedStack.cs

示例8: TestEmptyStackToArray_ShouldReturnEmptyArray

        public void TestEmptyStackToArray_ShouldReturnEmptyArray()
        {
            var stack = new ArrayStack<List<Dictionary<bool[], decimal>>>();

            var arr = stack.ToArray();

            Assert.AreEqual(0, arr.Length);
        }
开发者ID:IvanMladenov,项目名称:DataStructuresCourse,代码行数:8,代码来源:ArrayStackTests.cs

示例9: ToArray

 public void ToArray(int[] data)
 {
     ArrayStack<int> testStack = new ArrayStack<int>();
     for (int i = 0; i < data.Length; i++)
     {
         testStack.Push(data[i]);
     }
     int[] result = testStack.ToArray();
     CollectionAssert.AreEqual(data.Reverse(),result);
 }
开发者ID:EBojilova,项目名称:SoftUni-3,代码行数:10,代码来源:ArrayBasedStackTests.cs

示例10: array

        public void array()
        {
            ArrayStack<int> testArray = new ArrayStack<int>();
             testArray.Push(3);
             testArray.Push(5);
             testArray.Push(-2);
             testArray.Push(7);

             CollectionAssert.AreEqual(new int[] { 7, -2, 5, 3 }, testArray.ToArray());
        }
开发者ID:kosio197,项目名称:SoftUni_DataStructures,代码行数:10,代码来源:TestStack.cs

示例11: ToArray_PushFewItems_ShouldReturnInReversedOrder

        public void ToArray_PushFewItems_ShouldReturnInReversedOrder()
        {
            var stack = new ArrayStack<int>();

            stack.Push(1);
            stack.Push(2);
            stack.Push(3);
            var arr = stack.ToArray();

            CollectionAssert.AreEqual(new [] {3, 2, 1}, arr);
        }
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:11,代码来源:ToArrayTest.cs

示例12: ToArray

        public void ToArray()
        {
            var stack = new ArrayStack<int>();
            stack.Push(3);
            stack.Push(5);
            stack.Push(-2);
            stack.Push(7);

            int[] testArr = new[] {7, -2, 5, 3};
            CollectionAssert.AreEqual(testArr, stack.ToArray());
        }
开发者ID:Aleksandyr,项目名称:Software-University,代码行数:11,代码来源:ArrayStackUnitTest.cs

示例13: ToArrayMethodShouldReturnArrayWithTheElementsOfArrayStack

        public void ToArrayMethodShouldReturnArrayWithTheElementsOfArrayStack()
        {
            ArrayStack<int> arrayStack = new ArrayStack<int>();
            arrayStack.Push(3);
            arrayStack.Push(5);
            arrayStack.Push(-2);
            arrayStack.Push(7);
            int[] array = arrayStack.ToArray();

            Assert.AreEqual(7, array[0]);
        }
开发者ID:rozay,项目名称:Data-Structures,代码行数:11,代码来源:ArrayStackTests.cs

示例14: EmptyStackToArrayShouldReturnEmptyArray

        public void EmptyStackToArrayShouldReturnEmptyArray()
        {
            //Arrange
            var stack = new ArrayStack<int>(1);

            //Act
            var array = stack.ToArray();

            //Assert
            CollectionAssert.AreEqual(new int[0] {}, array);
        }
开发者ID:anichalakova,项目名称:DataStructuresHWs,代码行数:11,代码来源:UnitTestsArrayStack.cs

示例15: CheckEmptyStack_ToArrayMethod_ShouldReturnEmptyArray

    public void CheckEmptyStack_ToArrayMethod_ShouldReturnEmptyArray()
    {
        // Arrange
        ArrayStack<int> stack = new ArrayStack<int>();

        // Act
        int[] stackArr = stack.ToArray();

        // Assert
        Assert.AreEqual(0, stackArr.Length);
    }
开发者ID:kgerov,项目名称:Data-Structures,代码行数:11,代码来源:ArrayStackTester.cs


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