コード例 #1
0
        public void FixedCapacityStackOfStrings_PushAndPopString_SameString()
        {
            IFixedCapacityStringStack stack = new FixedCapacityCapacityStackOfStrings(1);

            stack.push("to");
            var res = stack.pop();

            Assert.AreEqual("to", res);
        }
コード例 #2
0
        //[ExpectedException(typeof(IndexOutOfRangeException))]
        public void FixedCapacityStackOfStrings_AddMoreThanCapacity_ResultsOverflow()
        {
            IFixedCapacityStringStack stack = new FixedCapacityCapacityStackOfStrings(1);

            stack.push("readyToOverflow");

            Assert.That(() => stack.push("overflow"),
                        Throws.TypeOf <IndexOutOfRangeException>());
        }