Пример #1
0
        public void Stack_Contains_ContainsMustWork(IStack<int> stack)
        {
            const int numberIsNotFromMass = 703;

            foreach (var elememt in MassOfNumber)
                stack.Push(elememt);

            var actual = stack.Contains(MassOfNumber[0]);
            Assert.Equal(true, actual);

            actual = stack.Contains(numberIsNotFromMass);
            Assert.Equal(false, actual);
        }
Пример #2
0
        public void Stack_Contains_ContainsMustWork(IStack <int> stack)
        {
            const int numberIsNotFromMass = 703;

            foreach (var elememt in MassOfNumber)
            {
                stack.Push(elememt);
            }

            var actual = stack.Contains(MassOfNumber[0]);

            Assert.AreEqual(true, actual);

            actual = stack.Contains(numberIsNotFromMass);
            Assert.AreEqual(false, actual);
        }
Пример #3
0
 public bool Contains(T value)
 {
     lock (SyncRoot)
     {
         return(stack.Contains(value));
     }
 }
Пример #4
0
        public bool Contains(int elt)
        {
            Chess.ObserveOperationCall(impl, "Contains");
            Chess.ObserveInteger("elt", elt);
            bool retval = impl.Contains(elt);

            Chess.ObserveBoolean("retval", retval);
            Chess.ObserveOperationReturn();
            return(retval);
        }
Пример #5
0
        public bool Contains(T elt)
        {
            Chess.ObserveOperationCall(impl, "Contains");
            Chess.ObserveObjectIdentity("elt", elt);
            bool retval = impl.Contains(elt);

            Chess.ObserveBoolean("retval", retval);
            Chess.ObserveOperationReturn();
            return(retval);
        }
Пример #6
0
 void CheckValue(int value, IStack stack)
 {
     if (stack.Contains(value))
     {
         Console.WriteLine("The stack contains " + value);
     }
     else
     {
         Console.WriteLine("The stack doesn't contain " + value);
     }
 }
Пример #7
0
 bool CheckValues(int nr, IStack stack)
 {
     if (stack.Contains(nr))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #8
0
 // For testing contains method.
 void CheckValues(IStack ArrayStack, int value)
 {
     if (ArrayStack.Contains(value))
     {
         Console.ForegroundColor = ConsoleColor.Green;
         Console.WriteLine("\n{0} is present in the stack!!", value);
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("\nOops, {0} is not present in the stack", value);
     }
     Console.ResetColor();
 }
Пример #9
0
        void CheckValues(IStack stack)
        {
            int value = 0;

            while (value != -1)
            {
                value = ReadTools.ReadInt("Search for a value (stop = -1): ", -1, 100);
                if (value != -1)
                {
                    if (stack.Contains(value))
                    {
                        Console.WriteLine($"The stack does contain {value}.");
                    }
                    else
                    {
                        Console.WriteLine($"The stack does not contain {value}.");
                    }
                }
            }
        }
Пример #10
0
 public bool Contains(T value)
 {
     return(stack.Contains(value));
 }
Пример #11
0
 /// <summary>
 ///     Checks whether or not a certain item is in the stack.
 /// </summary>
 /// <param name="item">The item to check for.</param>
 /// <returns><see langword="true" /> if the item was found, <see langword="false" /> otherwise.</returns>
 public bool Contains(T item) => internalStack.Contains(item);